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

The dialog which shows a MaskEditor. More...

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

Public Slots

void setDetectorContext (InstrumentModel *instrumentModel, DetectorItem *detectorItem)
 

Public Member Functions

 ExtendedDetectorDialog (QWidget *parent=nullptr)
 

Private Member Functions

void readSettings ()
 
void reject ()
 
void writeSettings ()
 

Private Attributes

DetectorMaskDelegatem_maskDelegate
 
MaskEditorm_maskEditor
 

Detailed Description

The dialog which shows a MaskEditor.

Definition at line 27 of file ExtendedDetectorDialog.h.

Constructor & Destructor Documentation

◆ ExtendedDetectorDialog()

ExtendedDetectorDialog::ExtendedDetectorDialog ( QWidget *  parent = nullptr)

Definition at line 24 of file ExtendedDetectorDialog.cpp.

25  : QDialog(parent), m_maskEditor(new MaskEditor), m_maskDelegate(new DetectorMaskDelegate(this))
26 {
27  setMinimumSize(256, 256);
28 
29  readSettings();
30 
31  setWindowTitle("Mask Editor");
32  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
33  setAttribute(Qt::WA_DeleteOnClose, true);
34  setModal(true);
35 
36  QVBoxLayout* layout = new QVBoxLayout;
37  QPushButton* button = new QPushButton("Close", this);
38  connect(button, &QPushButton::clicked, this, &ExtendedDetectorDialog::close);
39 
40  QHBoxLayout* buttonLayout = new QHBoxLayout;
41  buttonLayout->addStretch(1);
42  buttonLayout->setContentsMargins(4, 4, 4, 4);
43  buttonLayout->addWidget(button);
44 
45  layout->addWidget(m_maskEditor);
46  layout->addLayout(buttonLayout);
47 
48  layout->setContentsMargins(0, 0, 0, 0);
49  setLayout(layout);
50 
51  // hadling keyboar focus policies
52  button->setDefault(false);
53  button->setAutoDefault(false);
54  setFocusProxy(m_maskEditor);
55 
56  SpaceKeyEater* filter = new SpaceKeyEater(this);
57  installEventFilter(filter);
58  button->installEventFilter(filter);
59 }
The DetectorMaskDelegate class provides synchronization between DetectorItem (defined in InstrumentMo...
DetectorMaskDelegate * m_maskDelegate
Main class to draw masks on top of intensity data map.
Definition: MaskEditor.h:31
Filter out space bar key events, which is special case for dialog windows.

References m_maskEditor, and readSettings().

Here is the call graph for this function:

Member Function Documentation

◆ readSettings()

void ExtendedDetectorDialog::readSettings ( )
private

Definition at line 73 of file ExtendedDetectorDialog.cpp.

74 {
75  QSettings settings;
76  if (settings.childGroups().contains(Constants::S_MASKEDITOR)) {
77  settings.beginGroup(Constants::S_MASKEDITOR);
78  resize(settings.value(Constants::S_WINDOWSIZE, QSize(750, 650)).toSize());
79  move(settings.value(Constants::S_WINDOWPOSITION, QPoint(200, 200)).toPoint());
80  } else {
81  resize(750, 650);
82  }
83 }
const char S_MASKEDITOR[]
const char S_WINDOWPOSITION[]
const char S_WINDOWSIZE[]

References Constants::S_MASKEDITOR, Constants::S_WINDOWPOSITION, and Constants::S_WINDOWSIZE.

Referenced by ExtendedDetectorDialog().

◆ reject()

void ExtendedDetectorDialog::reject ( )
private

Definition at line 67 of file ExtendedDetectorDialog.cpp.

68 {
69  writeSettings();
70  QDialog::reject();
71 }

References writeSettings().

Here is the call graph for this function:

◆ setDetectorContext

void ExtendedDetectorDialog::setDetectorContext ( InstrumentModel instrumentModel,
DetectorItem detectorItem 
)
slot

Definition at line 61 of file ExtendedDetectorDialog.cpp.

63 {
64  m_maskDelegate->initMaskEditorContext(m_maskEditor, instrumentModel, detectorItem);
65 }
void initMaskEditorContext(MaskEditor *maskEditor, InstrumentModel *instrumentModel, DetectorItem *detectorItem)

References DetectorMaskDelegate::initMaskEditorContext(), m_maskDelegate, and m_maskEditor.

Here is the call graph for this function:

◆ writeSettings()

void ExtendedDetectorDialog::writeSettings ( )
private

Definition at line 85 of file ExtendedDetectorDialog.cpp.

86 {
87  QSettings settings;
88  settings.beginGroup(Constants::S_MASKEDITOR);
89  settings.setValue(Constants::S_WINDOWSIZE, this->size());
90  settings.setValue(Constants::S_WINDOWPOSITION, this->pos());
91  settings.endGroup();
92 }

References Constants::S_MASKEDITOR, Constants::S_WINDOWPOSITION, and Constants::S_WINDOWSIZE.

Referenced by reject().

Member Data Documentation

◆ m_maskDelegate

DetectorMaskDelegate* ExtendedDetectorDialog::m_maskDelegate
private

Definition at line 44 of file ExtendedDetectorDialog.h.

Referenced by setDetectorContext().

◆ m_maskEditor

MaskEditor* ExtendedDetectorDialog::m_maskEditor
private

Definition at line 43 of file ExtendedDetectorDialog.h.

Referenced by ExtendedDetectorDialog(), and setDetectorContext().


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