68 return this->lineEdit();
94 double step = singleStep();
96 double newVal = val + steps * step;
106 QValidator::State
validate(QString& input,
int& pos)
const override
110 if (input.isEmpty() || input ==
"-" || input ==
"+" || input ==
"." || input ==
"-." || input ==
"+.")
112 return QValidator::Intermediate;
116 double val = input.toDouble(&ok);
119 return QValidator::Invalid;
124 return QValidator::Intermediate;
127 return QValidator::Acceptable;
130 void fixup(QString& input)
const override
133 double val = input.toDouble(&ok);
154 QDoubleSpinBox::focusOutEvent(event);
165 return text.toDouble();
170 bool eventFilter(QObject* obj, QEvent* event)
override;
191 this->setValue(value);
192 this->interpretText();
194 emit editingFinished();
207 this->lineEdit()->setText(t);
236 this->setText(QString(text.c_str()));
264 this->setContentsMargins(0, 0, 0, 0);
265 QHBoxLayout* layout =
new QHBoxLayout;
271 this->setLayout(layout);
283 v0->setMinimumWidth(90);
284 v1->setMinimumWidth(90);
285 v2->setMinimumWidth(90);
288 layout->addWidget(
v0);
289 layout->addWidget(
v1);
290 layout->addWidget(
v2);
292 QObject::connect(
v0, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
293 QObject::connect(
v1, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
294 QObject::connect(
v2, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
296 QObject::connect(
nameLabel, SIGNAL(toggle(
bool)),
v0, SLOT(toggleDecimals(
bool)));
297 QObject::connect(
nameLabel, SIGNAL(toggle(
bool)),
v1, SLOT(toggleDecimals(
bool)));
298 QObject::connect(
nameLabel, SIGNAL(toggle(
bool)),
v2, SLOT(toggleDecimals(
bool)));
310 return Vec3f(
v0->getRealValue(),
v1->getRealValue(),
v2->getRealValue());
320 v0->setRange(min,
max);
321 v1->setRange(min,
max);
322 v2->setRange(min,
max);
325 void setRange(
double min0,
double max0,
double min1,
double max1,
double min2,
double max2)
327 v0->setRange(min0, max0);
328 v1->setRange(min1, max1);
329 v2->setRange(min2, max2);
357 this->setContentsMargins(0, 0, 0, 0);
358 QHBoxLayout* layout =
new QHBoxLayout;
363 this->setLayout(layout);
368 spinBox->setRange(-99999999, 99999999);
373 QObject::connect(
spinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
valueChange(); });
375 QObject::connect(
nameLabel, SIGNAL(toggle(
bool)),
spinBox, SLOT(toggleDecimals(
bool)));
387 return spinBox->getRealValue();
422 this->setContentsMargins(0, 0, 0, 0);
423 QHBoxLayout* layout =
new QHBoxLayout;
425 this->setLayout(layout);
436 layout->addWidget(
v0);
437 layout->addWidget(
v1);
438 layout->addWidget(
v2);
440 QObject::connect(
v0, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
441 QObject::connect(
v1, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
442 QObject::connect(
v2, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value) {emit
vec3fChange(); });
455 return Vec3f(
v0->getRealValue(),
v1->getRealValue(),
v2->getRealValue());
void fixup(QString &input) const override
QLineEdit * getLineEdit()
void stepBy(int steps) override
QPiecewiseDoubleSpinBox(QWidget *parent=nullptr)
void focusOutEvent(QFocusEvent *event) override
void toggleDecimals(bool v)
QValueDialog * mValueDialog
void contextMenuEvent(QContextMenuEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
bool eventFilter(QObject *obj, QEvent *event) override
void triggerEditingFinished(double value)
double setRealValue(double val)
void mouseReleaseEvent(QMouseEvent *event) override
void editingFinishedWithValue(double value)
void wheelEvent(QWheelEvent *event)
virtual QString textFromValue(double val) const override
virtual double valueFromText(const QString &text) const override
QValidator::State validate(QString &input, int &pos) const override
QToggleLabel(QWidget *parent=nullptr)
void mousePressEvent(QMouseEvent *event) override
QToggleLabel(std::string text, QWidget *parent=nullptr)
QPiecewiseDoubleSpinBox * spinBox
void setLabelMinimumWidth(int max)
~mPiecewiseDoubleSpinBox()
void setRange(double min, double max)
mPiecewiseDoubleSpinBox(double value, std::string name, QWidget *parent=nullptr)
This is an implementation of AdditiveCCD based on peridyno.
DYN_FUNC T minimum(const T &v0, const T &v1)
DYN_FUNC T maximum(const T &v0, const T &v1)