17 #include <QDoubleSpinBox>
18 #include <QVBoxLayout>
24 :
CustomEditor(parent), m_doubleEditor(new QDoubleSpinBox)
26 setFocusPolicy(Qt::StrongFocus);
30 auto layout =
new QVBoxLayout;
32 layout->setSpacing(0);
37 static_cast<void (QDoubleSpinBox::*)(
double)
>(&QDoubleSpinBox::valueChanged),
70 if (
m_data.type() != QVariant::Double)
71 throw std::runtime_error(
"DoubleEditor::update_components() -> Error. Wrong variant type");
Base class for all custom variant editors.
void setDataIntern(const QVariant &data)
Saves the data as given by editor's internal components and notifies the model.
QDoubleSpinBox * m_doubleEditor
void setSingleStep(double value)
void setDecimals(int decimals)
void update_components() override
Should update widget components from m_data, if necessary.
void setRange(double minimum, double maximum)
DoubleEditor(QWidget *parent=nullptr)
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.
materialitems.h Collection of materials to populate MaterialModel.