16 #include "Base/Util/Assert.h"
17 #include "Fit/Param/RealLimits.h"
30 double singleStep(
int decimals)
33 return 1. / std::pow(10., decimals - 1);
62 , m_box(new QComboBox)
65 setAutoFillBackground(
true);
66 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
68 auto* layout =
new QVBoxLayout;
70 layout->setSpacing(0);
71 layout->addWidget(
m_box);
81 return m_box->sizeHint();
86 return m_box->minimumSizeHint();
93 if (comboProperty.currentIndex() != index) {
95 setDataIntern(QVariant::fromValue<ComboProperty>(comboProperty));
133 connect(
m_box,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
136 disconnect(
m_box,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
146 setAutoFillBackground(
true);
147 setFocusPolicy(Qt::StrongFocus);
151 auto* layout =
new QVBoxLayout;
152 layout->setMargin(0);
153 layout->setSpacing(0);
167 : std::numeric_limits<double>::lowest());
169 : std::numeric_limits<double>::max());
187 if (new_value !=
m_data.toDouble())
193 ASSERT(
m_data.type() == QVariant::Double);
Defines class ComboProperty.
Defines CustomEditors classes.
Defines classes releted to event filtering.
Defines class ScientificSpinBox.
Defines struct SessionData.
virtual int internIndex()
Returns index for QComboBox.
void setConnected(bool isConnected)
virtual QStringList internLabels()
Returns list of labels for QComboBox.
virtual void onIndexChanged(int index)
void initEditor() override
Inits editor widgets from m_data.
QSize minimumSizeHint() const override
QSize sizeHint() const override
class WheelEventEater * m_wheel_event_filter
ComboPropertyEditor(QWidget *parent=nullptr)
Custom property to define list of string values with multiple selections. Intended for QVariant.
QStringList getValues() const
void setCurrentIndex(int index)
Base class for all custom variants editors.
void dataChanged(const QVariant &data)
Signal emit then user changed the data through the editor.
virtual void initEditor()
Inits editor widgets from m_data.
void setData(const QVariant &data)
Sets the data from the model to editor.
void setDataIntern(const QVariant &data)
Saves the data from the editor and informs external delegates.
void setDecimals(int decimals)
void initEditor() override
Inits editor widgets from m_data.
void setLimits(const RealLimits &limits)
void setSingleStep(double step)
ScientificSpinBoxEditor(QWidget *parent=nullptr)
class ScientificSpinBox * m_doubleEditor
void setMaximum(double max)
void setMinimum(double min)
void setValue(double val)
void setSingleStep(double step)
void valueChanged(double value)
Event filter to install on combo boxes and spin boxes to not to react on wheel events during scrollin...