-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQNumberBox.h
42 lines (36 loc) · 917 Bytes
/
QNumberBox.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef QNUMBER_BOX_H
#define QNUMBER_BOX_H
#include <QWidget>
class QLineEdit;
class QNumberBoxSlider;
class QNumberBox : public QWidget
{
Q_OBJECT
public:
explicit QNumberBox(double def,int precision =3, QWidget *parent = nullptr);
void setValue(double var);
double getValue();
private:
QLineEdit *numberEdit_;
QNumberBoxSlider *slider_;
int precision_;
Q_SIGNALS:
void valueChanged(double);
};
class QNumberBoxSlider : public QWidget{
Q_OBJECT
public:
QNumberBoxSlider();
protected:
virtual void enterEvent(QEnterEvent *) override;
virtual void leaveEvent(QEvent *) override;
virtual void paintEvent(QPaintEvent *) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *e) override;
Q_SIGNALS:
void moveSlider(qreal);
private:
bool enter;
QPoint lastPos;
};
#endif // QNumberBox_H