BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Utility functions to add/remove widgets to the layout on the fly. More...
Functions | |
void | clearGridLayout (QGridLayout *layout, bool deleteWidgets=true) |
Clear layout completely. More... | |
void | clearLayout (QLayout *layout, bool deleteWidgets=true) |
Removes content from box layout. More... | |
QWidget * | placeHolder () |
Returns empty widget to occupy place in layout. More... | |
void | removeColumn (QGridLayout *layout, int column, bool deleteWidgets=true) |
Removes column from grid layout. More... | |
void | removeRow (QGridLayout *layout, int row, bool deleteWidgets=true) |
Removes row from grid layout (important: doesn't change row count). More... | |
Utility functions to add/remove widgets to the layout on the fly.
Taken from https://stackoverflow.com/questions/5395266/removing-widgets-from-qgridlayout
Taken from https://stackoverflow.com/questions/5395266/removing-widgets-from-qgridlayout Caveat: according to explanations given, grid layouts can only grow and never shrink.
MVVM_VIEW_EXPORT void LayoutUtils::clearGridLayout | ( | QGridLayout * | layout, |
bool | deleteWidgets = true |
||
) |
Clear layout completely.
Definition at line 81 of file LayoutUtils.cpp.
References removeRow().
Referenced by ComponentFlatView::clearLayout(), and ModelView::PropertyFlatView::PropertyFlatViewImpl::update_grid_layout().
MVVM_VIEW_EXPORT void LayoutUtils::clearLayout | ( | QLayout * | layout, |
bool | deleteWidgets = true |
||
) |
Removes content from box layout.
Definition at line 21 of file LayoutUtils.cpp.
Referenced by WelcomeView::updateRecentProjectPanel().
MVVM_VIEW_EXPORT QWidget * LayoutUtils::placeHolder | ( | ) |
Returns empty widget to occupy place in layout.
Definition at line 131 of file LayoutUtils.cpp.
Referenced by EnvironmentEditor::EnvironmentEditor(), and SpecularBeamEditor::SpecularBeamEditor().
MVVM_VIEW_EXPORT void LayoutUtils::removeColumn | ( | QGridLayout * | layout, |
int | column, | ||
bool | deleteWidgets = true |
||
) |
Removes column from grid layout.
Removes all layout items on the given column from the given grid layout.
If deleteWidgets is true, all concerned child widgets become not only removed from the layout, but also deleted. Note that this function doesn't actually remove the column itself from the grid layout, as this isn't possible (i.e. the columnCount() and column indices will stay the same after this function has been called).
Definition at line 74 of file LayoutUtils.cpp.
References ModelView::Utils::remove().
MVVM_VIEW_EXPORT void LayoutUtils::removeRow | ( | QGridLayout * | layout, |
int | row, | ||
bool | deleteWidgets = true |
||
) |
Removes row from grid layout (important: doesn't change row count).
Removes all layout items on the given row from the given grid layout.
If deleteWidgets is true, all concerned child widgets become not only removed from the layout, but also deleted. Note that this function doesn't actually remove the row itself from the grid layout, as this isn't possible (i.e. the rowCount() and row indices will stay the same after this function has been called).
Definition at line 58 of file LayoutUtils.cpp.
References ModelView::Utils::remove().
Referenced by clearGridLayout().