BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InfoPanelToolBar.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/CommonWidgets/InfoPanelToolBar.cpp
6 //! @brief Declares class InfoPanelToolBar
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 <QAction>
17 #include <QHBoxLayout>
18 #include <QToolButton>
19 
20 namespace {
21 const int minimum_size = 25;
22 const QString icon_up = ":/images/dark-angle-up.svg";
23 const QString icon_down = ":/images/dark-angle-down.svg";
24 const QString expand_text = "Collapse/expand view";
25 } // namespace
26 
28  : QToolBar(parent), m_expandAction(new QAction(expand_text, this)), m_expanded(false)
29 {
30  setMinimumSize(minimum_size, minimum_size);
31  setProperty("_q_custom_style_disabled", QVariant(true));
32 
33  m_expandAction->setIcon(QIcon(icon_up));
34  m_expandAction->setToolTip(expand_text);
35  connect(m_expandAction, &QAction::triggered, this, &InfoPanelToolBar::onExpandButtonClicked);
36 
37  auto empty = new QWidget();
38  empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
39  addWidget(empty);
40 
41  addAction(m_expandAction);
42 }
43 
45 {
46  m_expanded = status;
47  if (m_expanded)
48  m_expandAction->setIcon(QIcon(icon_down));
49  else
50  m_expandAction->setIcon(QIcon(icon_up));
51 }
52 
54 {
57  emit expandButtonClicked();
58 }
Defines class InfoPanelToolBar.
void expandButtonClicked()
QAction * m_expandAction
InfoPanelToolBar(QWidget *parent=nullptr)
void setExpandStatus(bool status)