Commit abdc2f63 authored by Cory Quammen's avatar Cory Quammen
Browse files

pqProxyWidget: make showing group headers/footers optional

Make display of group headers and footers optional for custom
ParaView-based applications. Headers and footers are visible by
default, and are left on in the ParaView GUI application.
parent 3e281cb3
Pipeline #187036 waiting for manual action with stages
......@@ -103,14 +103,15 @@ void pqProxiesWidget::clear()
//-----------------------------------------------------------------------------
void pqProxiesWidget::addProxy(vtkSMProxy* proxy, const QString& componentName /*=QString()*/,
const QStringList& properties /*=QStringList()*/, bool applyChangesImmediately /*=false*/)
const QStringList& properties /*=QStringList()*/, bool applyChangesImmediately /*=false*/,
bool showHeadersFooters /*=true*/)
{
// TODO: add check to avoid duplicate insertions.
QList<pqInternals::ProxyInfo>& proxies = this->Internals->ComponentProxies[componentName];
pqInternals::ProxyInfo info;
info.Proxy = proxy;
info.ProxyWidget = new pqProxyWidget(proxy, properties, this);
info.ProxyWidget = new pqProxyWidget(proxy, properties, showHeadersFooters, this);
info.ProxyWidget->setApplyChangesImmediately(applyChangesImmediately);
info.ProxyWidget->setView(this->Internals->View);
this->connect(info.ProxyWidget, SIGNAL(changeAvailable()), SLOT(triggerChangeAvailable()));
......
......@@ -92,7 +92,8 @@ public Q_SLOTS:
* Add the widgets for a proxy.
*/
void addProxy(vtkSMProxy*, const QString& componentName = QString(),
const QStringList& properties = QStringList(), bool applyChangesImmediately = false);
const QStringList& properties = QStringList(), bool applyChangesImmediately = false,
bool showHeadersFooters = true);
/**
* Call this method once after all proxies have been added (or after clear)
......
......@@ -232,7 +232,7 @@ public:
/// an item for a group where there's a single widget for all the properties
/// in that group.
static pqProxyWidgetItem* newGroupItem(
pqPropertyWidget* widget, const QString& label, QObject* parentObj)
pqPropertyWidget* widget, const QString& label, bool showSeparators, QObject* parentObj)
{
if (widget->isSingleRowItem())
{
......@@ -243,7 +243,7 @@ public:
pqProxyWidgetItem* item = newItem(widget, QString(), parentObj);
item->Group = true;
if (!label.isEmpty() && widget->showLabel())
if (!label.isEmpty() && widget->showLabel() && showSeparators)
{
item->GroupHeader = pqProxyWidget::newGroupLabelWidget(label, widget->parentWidget());
item->GroupFooter = newGroupSeparator(widget->parentWidget());
......@@ -254,13 +254,13 @@ public:
/// Creates a new item for a property group with several widgets (for
/// individual properties in the group).
static pqProxyWidgetItem* newMultiItemGroupItem(const QString& group_label,
pqPropertyWidget* widget, const QString& widget_label, QObject* parentObj)
pqPropertyWidget* widget, const QString& widget_label, bool showSeparators, QObject* parentObj)
{
pqProxyWidgetItem* item = newItem(widget, widget_label, parentObj);
item->Group = true;
// ensure GroupTag is not null for multi-property groups.
item->GroupTag = group_label.isNull() ? QString("") : group_label;
if (!group_label.isEmpty())
if (!group_label.isEmpty() && showSeparators)
{
item->GroupHeader = pqProxyWidget::newGroupLabelWidget(group_label, widget->parentWidget());
item->GroupFooter = newGroupSeparator(widget->parentWidget());
......@@ -538,6 +538,7 @@ QWidget* pqProxyWidget::newGroupLabelWidget(
QLabel* label = new QLabel(QString("<html><b>%1</b></html>").arg(labelText), widget);
label->setWordWrap(true);
label->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
label->setObjectName("group_" + QString(labelText).remove(' '));
if (buttons.size() > 0)
{
......@@ -631,21 +632,23 @@ public:
pqProxyWidget::pqProxyWidget(vtkSMProxy* smproxy, QWidget* parentObject, Qt::WindowFlags wflags)
: Superclass(parentObject, wflags)
{
this->constructor(smproxy, QStringList(), parentObject, wflags);
this->constructor(smproxy, QStringList(), true, parentObject, wflags);
}
//-----------------------------------------------------------------------------
pqProxyWidget::pqProxyWidget(
vtkSMProxy* smproxy, const QStringList& properties, QWidget* parentObject, Qt::WindowFlags wflags)
vtkSMProxy* smproxy, const QStringList& properties, bool showHeadersFooters,
QWidget* parentObject, Qt::WindowFlags wflags)
: Superclass(parentObject, wflags)
{
this->constructor(smproxy, properties, parentObject, wflags);
this->constructor(smproxy, properties, showHeadersFooters, parentObject, wflags);
this->updatePanel();
}
//-----------------------------------------------------------------------------
void pqProxyWidget::constructor(
vtkSMProxy* smproxy, const QStringList& properties, QWidget* parentObject, Qt::WindowFlags wflags)
vtkSMProxy* smproxy, const QStringList& properties, bool showHeadersFooters,
QWidget* parentObject, Qt::WindowFlags wflags)
{
assert(smproxy);
(void)parentObject;
......@@ -662,6 +665,9 @@ void pqProxyWidget::constructor(
this->Internals->RequestUpdatePanel.setSingleShot(true);
this->connect(&this->Internals->RequestUpdatePanel, SIGNAL(timeout()), SLOT(updatePanel()));
// record whether to create and show header and footers for property groups
this->ShowHeadersFooters = showHeadersFooters;
QGridLayout* gridLayout = new QGridLayout(this);
gridLayout->setMargin(pqPropertiesPanel::suggestedMargin());
gridLayout->setHorizontalSpacing(pqPropertiesPanel::suggestedHorizontalSpacing());
......@@ -1039,7 +1045,8 @@ void pqProxyWidget::createPropertyWidgets(const QStringList& properties)
gwidget->setObjectName(QString(smgroup->GetPanelWidget()).remove(' '));
auto item =
pqProxyWidgetItem::newGroupItem(gwidget, QString(smgroup->GetXMLLabel()), this);
pqProxyWidgetItem::newGroupItem(gwidget, QString(smgroup->GetXMLLabel()),
this->ShowHeadersFooters, this);
item->Advanced = (smgroup->GetPanelVisibility() &&
strcmp(smgroup->GetPanelVisibility(), "advanced") == 0);
item->SearchTags << smgroup->GetPanelWidget();
......@@ -1094,7 +1101,8 @@ void pqProxyWidget::createPropertyWidgets(const QStringList& properties)
auto item = (smgroup == nullptr) ? pqProxyWidgetItem::newItem(pwidget, QString(itemLabel), this)
: pqProxyWidgetItem::newMultiItemGroupItem(
smgroup->GetXMLLabel(), pwidget, QString(itemLabel), this);
smgroup->GetXMLLabel(), pwidget, QString(itemLabel),
this->ShowHeadersFooters, this);
// save record of the property widget and containing widget
item->SearchTags << xmllabel << xmlDocumentation << smkey.c_str();
......
......@@ -62,8 +62,8 @@ class PQCOMPONENTS_EXPORT pqProxyWidget : public QWidget
public:
pqProxyWidget(
vtkSMProxy* proxy, QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags{});
pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties, QWidget* parent = 0,
Qt::WindowFlags flags = Qt::WindowFlags{});
pqProxyWidget(vtkSMProxy* proxy, const QStringList& properties, bool showHeadersFooters = true,
QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags{});
~pqProxyWidget() override;
/**
......@@ -212,7 +212,7 @@ private:
* the actual constructor implementation.
*/
void constructor(
vtkSMProxy* proxy, const QStringList& properties, QWidget* parent, Qt::WindowFlags flags);
vtkSMProxy* proxy, const QStringList& properties, bool showHeadersFooters, QWidget* parent, Qt::WindowFlags flags);
/**
* create all widgets
......@@ -234,6 +234,7 @@ private:
bool ApplyChangesImmediately;
bool UseDocumentationForLabels;
bool ShowHeadersFooters = false;
class pqInternals;
pqInternals* Internals;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment