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

Description

Definition at line 23 of file SliderSettingsWidget.h.

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

Signals

void lockzChanged (bool value)
 
void sliderRangeFactorChanged (double value)
 

Public Member Functions

 SliderSettingsWidget (QWidget *parent=nullptr)
 

Private Slots

void onLockZChanged (int state)
 
void rangeChanged ()
 

Private Attributes

double m_currentSliderRange
 
QCheckBox * m_lockzCheckBox
 
QRadioButton * m_radio1
 
QRadioButton * m_radio2
 
QRadioButton * m_radio3
 

Constructor & Destructor Documentation

◆ SliderSettingsWidget()

SliderSettingsWidget::SliderSettingsWidget ( QWidget *  parent = nullptr)

Definition at line 23 of file SliderSettingsWidget.cpp.

24  : QWidget(parent)
25  , m_currentSliderRange(100.0)
26  , m_radio1(nullptr)
27  , m_radio2(nullptr)
28  , m_radio3(nullptr)
29  , m_lockzCheckBox(nullptr)
30 {
31  // tuning selectors
32  QString tooltip("Allows to tune sample parameters within +/- of given range \nwith the help of "
33  "the slider.");
34 
35  auto* label = new QLabel("Tuning:");
36  label->setToolTip(tooltip);
37 
38  m_radio1 = new QRadioButton("10%");
39  m_radio1->setAutoExclusive(true);
40  m_radio1->setToolTip(tooltip);
41  connect(m_radio1, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
42 
43  m_radio2 = new QRadioButton("100%");
44  m_radio2->setChecked(true);
45  m_radio2->setAutoExclusive(true);
46  m_radio2->setToolTip(tooltip);
47  connect(m_radio2, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
48 
49  m_radio3 = new QRadioButton("1000%");
50  m_radio3->setAutoExclusive(true);
51  m_radio3->setToolTip(tooltip);
52  connect(m_radio3, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
53 
54  // Fix z-axis
55  m_lockzCheckBox = new QCheckBox("Lock-Z");
56  m_lockzCheckBox->setToolTip(
57  "Preserve (min, max) range of intensity axis during parameter tuning.");
58  connect(m_lockzCheckBox, &QCheckBox::stateChanged, this, &SliderSettingsWidget::onLockZChanged);
59 
60  auto* hbox = new QHBoxLayout;
61 
62  hbox->addWidget(label);
63  hbox->addWidget(m_radio1);
64  hbox->addWidget(m_radio2);
65  hbox->addWidget(m_radio3);
66  hbox->addStretch(1);
67  hbox->addWidget(m_lockzCheckBox);
68 
69  setLayout(hbox);
70 }
void onLockZChanged(int state)

References m_lockzCheckBox, m_radio1, m_radio2, m_radio3, onLockZChanged(), and rangeChanged().

Here is the call graph for this function:

Member Function Documentation

◆ lockzChanged

void SliderSettingsWidget::lockzChanged ( bool  value)
signal

◆ onLockZChanged

void SliderSettingsWidget::onLockZChanged ( int  state)
privateslot

Definition at line 84 of file SliderSettingsWidget.cpp.

85 {
86  if (state == Qt::Unchecked)
87  emit lockzChanged(false);
88  else if (state == Qt::Checked)
89  emit lockzChanged(true);
90 }
void lockzChanged(bool value)

References lockzChanged().

Referenced by SliderSettingsWidget().

◆ rangeChanged

void SliderSettingsWidget::rangeChanged ( )
privateslot

Definition at line 72 of file SliderSettingsWidget.cpp.

73 {
74  if (m_radio1->isChecked())
75  m_currentSliderRange = 10.0;
76  else if (m_radio2->isChecked())
77  m_currentSliderRange = 100.0;
78  else if (m_radio3->isChecked())
79  m_currentSliderRange = 1000.0;
80 
82 }
void sliderRangeFactorChanged(double value)

References m_currentSliderRange, m_radio1, m_radio2, m_radio3, and sliderRangeFactorChanged().

Referenced by SliderSettingsWidget().

◆ sliderRangeFactorChanged

void SliderSettingsWidget::sliderRangeFactorChanged ( double  value)
signal

Member Data Documentation

◆ m_currentSliderRange

double SliderSettingsWidget::m_currentSliderRange
private

Definition at line 38 of file SliderSettingsWidget.h.

Referenced by rangeChanged().

◆ m_lockzCheckBox

QCheckBox* SliderSettingsWidget::m_lockzCheckBox
private

Definition at line 42 of file SliderSettingsWidget.h.

Referenced by SliderSettingsWidget().

◆ m_radio1

QRadioButton* SliderSettingsWidget::m_radio1
private

Definition at line 39 of file SliderSettingsWidget.h.

Referenced by SliderSettingsWidget(), and rangeChanged().

◆ m_radio2

QRadioButton* SliderSettingsWidget::m_radio2
private

Definition at line 40 of file SliderSettingsWidget.h.

Referenced by SliderSettingsWidget(), and rangeChanged().

◆ m_radio3

QRadioButton* SliderSettingsWidget::m_radio3
private

Definition at line 41 of file SliderSettingsWidget.h.

Referenced by SliderSettingsWidget(), and rangeChanged().


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