BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
JobSelectorToolBar Class Reference

Styled tool bar on top of JobSelector with run/remove job buttons. More...

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

Public Member Functions

 JobSelectorToolBar (JobSelectorActions *actions, 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 *)
 

Private Attributes

QToolButton * m_removeJobButton
 
QToolButton * m_runJobButton
 

Detailed Description

Styled tool bar on top of JobSelector with run/remove job buttons.

Definition at line 26 of file JobSelectorToolBar.h.

Constructor & Destructor Documentation

◆ JobSelectorToolBar()

JobSelectorToolBar::JobSelectorToolBar ( JobSelectorActions actions,
QWidget *  parent = nullptr 
)
explicit

Definition at line 19 of file JobSelectorToolBar.cpp.

20  : StyledToolBar(parent), m_runJobButton(new QToolButton), m_removeJobButton(new QToolButton)
21 {
22  setMinimumSize(minimumHeight(), minimumHeight());
23 
24  m_runJobButton->setText("Run");
25  m_runJobButton->setIcon(QIcon(":/images/play.svg"));
26  m_runJobButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
27  m_runJobButton->setToolTip("Run currently selected job");
28  addWidget(m_runJobButton);
29 
30  m_removeJobButton->setText("Remove");
31  m_removeJobButton->setIcon(QIcon(":/images/delete.svg"));
32  m_removeJobButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
33  m_removeJobButton->setToolTip("Remove currently selected job.");
34  addWidget(m_removeJobButton);
35 
36  connect(m_runJobButton, &QToolButton::clicked, actions, &JobSelectorActions::onRunJob);
37  connect(m_removeJobButton, &QToolButton::clicked, actions, &JobSelectorActions::onRemoveJob);
38 }
QToolButton * m_removeJobButton
QToolButton * m_runJobButton
StyledToolBar(QWidget *parent=nullptr)

References m_removeJobButton, m_runJobButton, JobSelectorActions::onRemoveJob(), and JobSelectorActions::onRunJob().

Here is the call graph for this function:

Member Function Documentation

◆ addSpacing()

void StyledToolBar::addSpacing ( int  width = 2)
inherited

Width of the spacing between buttons.

Definition at line 37 of file StyledToolBar.cpp.

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

Referenced by ItemComboToolBar::setActionList().

◆ addStyledExpand()

void StyledToolBar::addStyledExpand ( )
inherited

Definition at line 44 of file StyledToolBar.cpp.

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

Referenced by ItemComboToolBar::setActionList().

◆ addStyledSeparator()

void StyledToolBar::addStyledSeparator ( )
inherited

Definition at line 28 of file StyledToolBar.cpp.

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

Referenced by SampleToolBar::SampleToolBar().

◆ contextMenuEvent()

void StyledToolBar::contextMenuEvent ( QContextMenuEvent *  )
protectedinherited

Definition at line 51 of file StyledToolBar.cpp.

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

Member Data Documentation

◆ m_removeJobButton

QToolButton* JobSelectorToolBar::m_removeJobButton
private

Definition at line 34 of file JobSelectorToolBar.h.

Referenced by JobSelectorToolBar().

◆ m_runJobButton

QToolButton* JobSelectorToolBar::m_runJobButton
private

Definition at line 33 of file JobSelectorToolBar.h.

Referenced by JobSelectorToolBar().


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