BornAgain  1.19.0
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/coregui/utils/LayoutUtils.h
6 //! @brief Defines LayoutUtils namespace
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_COREGUI_UTILS_LAYOUTUTILS_H
16 #define BORNAGAIN_GUI_COREGUI_UTILS_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 LayoutUtils {
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 } // namespace LayoutUtils
42 
43 #endif // BORNAGAIN_GUI_COREGUI_UTILS_LAYOUTUTILS_H
Utility functions to add/remove widgets to the layout on the fly.
Definition: LayoutUtils.h:25
void removeRow(QGridLayout *layout, int row, bool deleteWidgets=true)
Removes row from grid layout (important: doesn't change row count).
Definition: LayoutUtils.cpp:58
void removeColumn(QGridLayout *layout, int column, bool deleteWidgets=true)
Removes column from grid layout.
Definition: LayoutUtils.cpp:74
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.
Definition: LayoutUtils.cpp:21
QWidget * placeHolder()
Returns empty widget to occupy place in layout.
void clearGridLayout(QGridLayout *layout, bool deleteWidgets=true)
Clear layout completely.
Definition: LayoutUtils.cpp:81