PeriDyno 1.2.1
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->setRange(-999999, 999999);
21 this->setContentsMargins(0, 0, 0, 0);
22
23 connect(this, &QDoubleSpinBox::editingFinished, this, &QPiecewiseDoubleSpinBox::onEditingFinished);
24
25 this->setDecimals(decimalsMax);
26
27 lineEdit()->installEventFilter(this);
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 this->setDecimals(decimalsMax);
40 this->setKeyboardTracking(false);
41 }
42
43 void QPiecewiseDoubleSpinBox::wheelEvent(QWheelEvent* event)
44 {
45
46 }
47
48 void QPiecewiseDoubleSpinBox::contextMenuEvent(QContextMenuEvent* event)
49 {
50 QDoubleSpinBox::contextMenuEvent(event);
51 }
52
54 {
55 if (event->button() == Qt::MiddleButton)
56 {
58 }
59
60 QDoubleSpinBox::mousePressEvent(event);
61
62 }
63
65 {
66 QDoubleSpinBox::mouseReleaseEvent(event);
67 }
68
70 {
71 QDoubleSpinBox::mouseMoveEvent(event);
72
73 }
74
75 bool QPiecewiseDoubleSpinBox::eventFilter(QObject* obj, QEvent* event)
76 {
77 if (obj == lineEdit())
78 {
79 if (event->type() == QEvent::MouseButtonPress)
80 {
81 QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
82 if (mouseEvent->button() == Qt::MiddleButton)
83 {
85 return true;
86 }
87 }
88 }
89 return QDoubleSpinBox::eventFilter(obj, event);
90 }
91
93 {
94 if (mValueDialog == nullptr)
95 mValueDialog = new QValueDialog(this);
96 mValueDialog->updateDialogPosition();
97 mValueDialog->show();
98 }
99
101 {
102 this->setKeyboardTracking(true);
103 realValue = val;
104 this->lineEdit()->setText(QString::number(realValue, 10, displayDecimals));
105 this->setKeyboardTracking(false);
106
107 return realValue;
108 }
109
110}
111
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
bool eventFilter(QObject *obj, QEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25