BornAgain  1.19.0
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/coregui/mainwindow/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 
19 StyledToolBar::StyledToolBar(QWidget* parent) : QToolBar(parent)
20 {
21  setMovable(false);
22  const int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
23  setIconSize(QSize(size, size));
24  setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
25  setContentsMargins(0, 0, 0, 0);
26 }
27 
29 {
30  addWidget(new QLabel(" "));
31  addSeparator();
32  addWidget(new QLabel(" "));
33 }
34 
35 //! Width of the spacing between buttons
36 
38 {
39  QString space;
40  space.fill(' ', width);
41  addWidget(new QLabel(space));
42 }
43 
45 {
46  QWidget* empty = new QWidget();
47  empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
48  addWidget(empty);
49 }
50 
51 void StyledToolBar::contextMenuEvent(QContextMenuEvent*)
52 {
53  // Context menu reimplemented to suppress the default one
54 }
Defines class StyledToolBar.
StyledToolBar(QWidget *parent=nullptr)
void addStyledSeparator()
void addStyledExpand()
void contextMenuEvent(QContextMenuEvent *)
void addSpacing(int width=2)
Width of the spacing between buttons.