BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
LayoutUtils.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Tool/LayoutUtils.h
6 //! @brief Defines namespace GUI::Util::Layout
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_TOOL_LAYOUTUTILS_H
16 #define BORNAGAIN_GUI_VIEW_TOOL_LAYOUTUTILS_H
17 
18 class QLayout;
19 class QGridLayout;
20 class QWidget;
21 
22 //! Utility functions to add/remove widgets to the layout on the fly.
23 //! Taken from https://stackoverflow.com/questions/5395266/removing-widgets-from-qgridlayout
24 
25 namespace GUI::Util::Layout {
26 
27 //! Removes content from box layout.
28 void clearLayout(QLayout* layout, bool deleteWidgets = true);
29 
30 //! Removes row from grid layout (important: doesn't change row count).
31 void removeRow(QGridLayout* layout, int row, bool deleteWidgets = true);
32 
33 //! Removes column from grid layout.
34 void removeColumn(QGridLayout* layout, int column, bool deleteWidgets = true);
35 
36 //! Clear layout completely.
37 void clearGridLayout(QGridLayout* layout, bool deleteWidgets = true);
38 
39 //! Returns empty widget to occupy place in layout.
40 QWidget* placeHolder();
41 
42 } // namespace GUI::Util::Layout
43 
44 #endif // BORNAGAIN_GUI_VIEW_TOOL_LAYOUTUTILS_H
Utility functions to add/remove widgets to the layout on the fly. Taken from https://stackoverflow....
Definition: LayoutUtils.h:25
void removeColumn(QGridLayout *layout, int column, bool deleteWidgets=true)
Removes column from grid layout.
void removeRow(QGridLayout *layout, int row, bool deleteWidgets=true)
Removes row from grid layout (important: doesn't change row count).
Definition: LayoutUtils.cpp:92
QWidget * placeHolder()
Returns empty widget to occupy place in layout.
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.
Definition: LayoutUtils.cpp:68
void clearGridLayout(QGridLayout *layout, bool deleteWidgets=true)
Clear layout completely.