BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
StyledToolbar.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Common/StyledToolbar.cpp
6 //! @brief Implements class StyledToolbar
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 
16 #include <QLabel>
17 #include <QStyle>
18 
20  : QToolBar(parent)
21 {
22  setMovable(false);
23  const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
24  setIconSize(QSize(size, size));
25  setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
26  setContentsMargins(0, 0, 0, 0);
27 }
28 
30 {
31  addWidget(new QLabel(" "));
32  addSeparator();
33  addWidget(new QLabel(" "));
34 }
35 
36 //! Width of the spacing between buttons
37 
39 {
40  QString space;
41  space.fill(' ', width);
42  addWidget(new QLabel(space));
43 }
44 
46 {
47  auto* empty = new QWidget();
48  empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
49  addWidget(empty);
50 }
51 
52 void StyledToolbar::contextMenuEvent(QContextMenuEvent*)
53 {
54  // Context menu reimplemented to suppress the default one
55 }
Defines class StyledToolbar.
void addStyledSeparator()
void addStyledExpand()
StyledToolbar(QWidget *parent=nullptr)
void addSpacing(int width=2)
Width of the spacing between buttons.
void contextMenuEvent(QContextMenuEvent *) override