Skip to content

Commit

Permalink
Added mapping between group names and group box widgets.
Browse files Browse the repository at this point in the history
In that way we can e.g. hide some group widgets, as is done in
SmoothNeighboursDialog.

Refs #7441
  • Loading branch information
arturbekasov committed Jul 22, 2013
1 parent f9e44b2 commit 097b57e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ namespace API
/// Each dynamically created PropertyWidget
QHash<QString, PropertyWidget*> m_propWidgets;

/// Mapping between group and it's dynamically created widget
QHash<QString, QGroupBox*> m_groupWidgets;

/// Viewport containing the grid of property widgets
QWidget * m_viewport;

Expand Down
9 changes: 7 additions & 2 deletions Code/Mantid/MantidQt/API/src/AlgorithmPropertiesWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ namespace API
// Delete all widgets in the layout
QLayoutItem *child;
while ((child = m_inputGrid->takeAt(0)) != 0) {
delete child->widget();
if(child->widget())
child->widget()->deleteLater();

delete child;
}

Expand Down Expand Up @@ -226,7 +228,7 @@ namespace API
else
{
// Make a groupbox with a border and a light background
QGroupBox * grpBox = new QGroupBox(QString::fromStdString(group) );
QGroupBox* grpBox = new QGroupBox(QString::fromStdString(group) );
grpBox->setAutoFillBackground(true);
grpBox->setStyleSheet(
"QGroupBox { border: 1px solid gray; border-radius: 4px; font-weight: bold; margin-top: 4px; margin-bottom: 4px; padding-top: 16px; }"
Expand All @@ -238,9 +240,12 @@ namespace API
// Put the frame in the main grid
m_inputGrid->addWidget(grpBox, row, 0, 1, 4);

m_groupWidgets[QString::fromStdString(group)] = grpBox;

// Make a layout in the grp box
m_currentGrid = new QGridLayout;
grpBox->setLayout(m_currentGrid);

row++;
}
}
Expand Down

0 comments on commit 097b57e

Please sign in to comment.