BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularDataWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotSpecular/SpecularDataWidget.cpp
6 //! @brief Implements class SpecularDataWidget
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 
17 #include "GUI/Util/ActionFactory.h"
21 #include <QBoxLayout>
22 #include <QMenu>
23 
25  : SessionItemWidget(parent)
26  , m_intensity_canvas(new SpecularDataCanvas)
27  , m_propertyWidget(new SpecularDataPropertyWidget(this))
28 {
29  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
30  m_propertyWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
31 
32  auto* hlayout = new QHBoxLayout(this);
33  hlayout->setMargin(0);
34  hlayout->setSpacing(0);
35  hlayout->addWidget(m_intensity_canvas);
36  hlayout->addWidget(m_propertyWidget);
37 
38  connect(m_intensity_canvas, &SpecularDataCanvas::customContextMenuRequested, this,
40 
43 
44  m_propertyWidget->setVisible(false);
45 }
46 
48 {
52 
54 }
55 
57 {
58  return m_intensity_canvas->actionList() + QList<QAction*>{m_togglePropertiesAction};
59 }
60 
62 {
63  QMenu menu;
64  for (auto* action : actionList())
65  menu.addAction(action);
66  menu.exec(point);
67 }
68 
70 {
72 }
Defines class ActionFactory.
Defines functions in namespace GUI::Model::DataItemUtils.
Defines class SpecularDataCanvas.
Defines class SpecularDataItem.
Defines class SpecularDataPropertyWidget.
Defines class SpecularDataWidget.
static QAction * createTogglePropertiesPanelAction(QObject *parent, QWidget *toggledWidget=nullptr)
Create "toggle properties panel" action.
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....
SessionItem * currentItem()
virtual void setItem(SessionItem *item)
Base class for a GUI data item.
Definition: SessionItem.h:204
void setItem(SessionItem *intensityItem) override
QList< QAction * > actionList() override
Widget to edit properties of a SpecularDataItem or a Data1DViewItem.
void setItem(SpecularDataItem *item)
QList< QAction * > actionList() override
SpecularDataPropertyWidget * m_propertyWidget
void setItem(SessionItem *jobItem) override
SpecularDataWidget(QWidget *parent=nullptr)
void onContextMenuRequest(const QPoint &point)
SpecularDataItem * specularDataItem()
SpecularDataCanvas * m_intensity_canvas
QAction * m_togglePropertiesAction
SpecularDataItem * specularDataItem(SessionItem *parent)
Returns SpecularDataItem contained as a child in givent parent.