PeriDyno 1.0.0
Loading...
Searching...
No Matches
QPiecewiseDoubleSpinBox.cpp
Go to the documentation of this file.
2
3#include "Module.h"
4#include "Node.h"
5#include "Field.h"
6#include "SceneGraphFactory.h"
7
8#include <QVBoxLayout>
9
10#include <memory>
11#include "QValueDialog.h"
12
13namespace dyno
14{
15
16
18 : QDoubleSpinBox(parent)
19 {
20 //this->lineEdit()->setMouseTracking(true);
21 this->setRange(-999999, 999999);
22 this->setContentsMargins(0, 0, 0, 0);
23
24 connect(this, SIGNAL(valueChanged(double)), this, SLOT(ModifyValueAndUpdate(double)));
25 connect(this->lineEdit(), SIGNAL(textEdited(const QString&)), this, SLOT(LineEditStart(const QString&)));
26
27 this->setDecimals(decimalsMax);
28 this->setKeyboardTracking(false);
29
30 }
31
33 : QDoubleSpinBox(parent)
34 {
35 this->setRange(-999999, 999999);
36 this->setValue(v);
37 this->setRealValue(v);
38
39 connect(this, SIGNAL(valueChanged(double)), this, SLOT(ModifyValueAndUpdate(double)));
40 connect(this->lineEdit(), SIGNAL(textEdited(const QString&)), this, SLOT(LineEditStart(const QString&)));
41
42 this->setDecimals(decimalsMax);
43 this->setKeyboardTracking(false);
44
45
46 }
47
49 {
50 auto v = this->value();
51 const auto& value = qStr.toDouble();
52 auto min = this->minimum();
53 auto max = this->maximum();
54
55 if (value < this->minimum())
56 {
57 this->lineEdit()->setText(QString::number(this->minimum()));
58 }
59 if (value > this->maximum())
60 {
61 this->lineEdit()->setText(QString::number(this->maximum()));
62 }
63
64 return;
65 }
66
68 {
69 realValue = v;
70 this->setValue(realValue);
71
72 return;
73 }
74
75 void QPiecewiseDoubleSpinBox::wheelEvent(QWheelEvent* event)
76 {
77
78 }
79 void QPiecewiseDoubleSpinBox::contextMenuEvent(QContextMenuEvent* event)
80 {
81
82 if(ValueModify== nullptr)
83 ValueModify = new QValueDialog(this);
84 ValueModify->updateDialogPosition();
85 ValueModify->show();
86 }
87
88
90 {
91 QDoubleSpinBox::mousePressEvent(event);
92
93 }
94
96 {
97 QDoubleSpinBox::mouseReleaseEvent(event);
98 }
99
101 {
102 QDoubleSpinBox::mouseMoveEvent(event);
103
104 }
105
107 {
108 this->setRealValue(v);
109
110 }
111
113 {
114
115 this->setKeyboardTracking(true);
116 this->setRealValue(v);
117 this->lineEdit()->setText(QString::number(realValue, 10, displayDecimals));
118 this->setKeyboardTracking(false);
119 }
120
121
122}
123
double Real
Definition Typedef.inl:23
QPiecewiseDoubleSpinBox(QWidget *parent=nullptr)
void contextMenuEvent(QContextMenuEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
void LineEditStart(const QString &qStr)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
DYN_FUNC T minimum(const T &v0, const T &v1)
Definition SimpleMath.h:120
DYN_FUNC T maximum(const T &v0, const T &v1)
Definition SimpleMath.h:160
#define max(x, y)
Definition svd3_cuda.h:41