BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
StyledToolbar Class Reference

Description

The StyledToolbar class represents our standard narrow toolbar with the height 24 pixels.

Definition at line 22 of file StyledToolbar.h.

Inheritance diagram for StyledToolbar:
[legend]
Collaboration diagram for StyledToolbar:
[legend]

Public Member Functions

 StyledToolbar (QWidget *parent=nullptr)
 
void addSpacing (int width=2)
 Width of the spacing between buttons. More...
 
void addStyledExpand ()
 
void addStyledSeparator ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *) override
 

Constructor & Destructor Documentation

◆ StyledToolbar()

StyledToolbar::StyledToolbar ( QWidget *  parent = nullptr)
explicit

Definition at line 19 of file StyledToolbar.cpp.

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 }

Member Function Documentation

◆ addSpacing()

void StyledToolbar::addSpacing ( int  width = 2)

Width of the spacing between buttons.

Definition at line 38 of file StyledToolbar.cpp.

39 {
40  QString space;
41  space.fill(' ', width);
42  addWidget(new QLabel(space));
43 }

Referenced by ItemComboToolbar::setActionList().

◆ addStyledExpand()

void StyledToolbar::addStyledExpand ( )

Definition at line 45 of file StyledToolbar.cpp.

46 {
47  auto* empty = new QWidget();
48  empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
49  addWidget(empty);
50 }

Referenced by ItemComboToolbar::setActionList().

◆ addStyledSeparator()

void StyledToolbar::addStyledSeparator ( )

Definition at line 29 of file StyledToolbar.cpp.

30 {
31  addWidget(new QLabel(" "));
32  addSeparator();
33  addWidget(new QLabel(" "));
34 }

◆ contextMenuEvent()

void StyledToolbar::contextMenuEvent ( QContextMenuEvent *  )
overrideprotected

Definition at line 52 of file StyledToolbar.cpp.

53 {
54  // Context menu reimplemented to suppress the default one
55 }

The documentation for this class was generated from the following files: