DtkWidget 5.6.0.2
DTK Widget module
dspinbox.h
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DSPINBOX_H
6#define DSPINBOX_H
7
8#include <dtkwidget_global.h>
9#include <DObject>
10
11#include <QSpinBox>
12
13DWIDGET_BEGIN_NAMESPACE
14
15class DSpinBoxPrivate;
16class LIBDTKWIDGETSHARED_EXPORT DSpinBox : public QSpinBox, public DTK_CORE_NAMESPACE::DObject
17{
18 Q_OBJECT
19
20 Q_PROPERTY(bool alert READ isAlert WRITE setAlert NOTIFY alertChanged)
21 Q_PROPERTY(int defaultValue READ defaultValue WRITE setDefaultValue NOTIFY defaultValueChanged)
22
23public:
24 explicit DSpinBox(QWidget *parent = nullptr);
25
26 QLineEdit *lineEdit() const;
27
28 bool isAlert() const;
29 void showAlertMessage(const QString &text, int duration = 3000);
30 void showAlertMessage(const QString &text, QWidget *follower, int duration = 3000);
31 D_DECL_DEPRECATED int defaultValue() const;
32
33 void setEnabledEmbedStyle(bool enabled);
34
35public Q_SLOTS:
36 void setAlert(bool alert);
37 D_DECL_DEPRECATED void setDefaultValue(int defaultValue);
38
39Q_SIGNALS:
40 void alertChanged(bool alert);
41 D_DECL_DEPRECATED void defaultValueChanged(int defaultValue);
42
43private:
44 D_DECLARE_PRIVATE(DSpinBox)
45};
46
48class LIBDTKWIDGETSHARED_EXPORT DDoubleSpinBox : public QDoubleSpinBox, public DTK_CORE_NAMESPACE::DObject
49{
50 Q_OBJECT
51
52 Q_PROPERTY(bool alert READ isAlert WRITE setAlert NOTIFY alertChanged)
53 Q_PROPERTY(double defaultValue READ defaultValue WRITE setDefaultValue NOTIFY defaultValueChanged)
54
55public:
56 explicit DDoubleSpinBox(QWidget *parent = nullptr);
57
58 bool isAlert() const;
59 void showAlertMessage(const QString &text, int duration = 3000);
60 void showAlertMessage(const QString &text, QWidget *follower, int duration = 3000);
61 D_DECL_DEPRECATED double defaultValue() const;
62
63 QLineEdit *lineEdit() const;
64 void setEnabledEmbedStyle(bool enabled);
65
66public Q_SLOTS:
67 void setAlert(bool alert);
68 D_DECL_DEPRECATED void setDefaultValue(double defaultValue);
69
70Q_SIGNALS:
71 void alertChanged(bool alert);
72 D_DECL_DEPRECATED void defaultValueChanged(double defaultValue);
73
74private:
75 D_DECLARE_PRIVATE(DDoubleSpinBox)
76};
77
78DWIDGET_END_NAMESPACE
79
80#endif // DSPINBOX_H
Definition: dspinbox_p.h:29
类似 DDoubleSpinBox.
Definition: dspinbox.h:49
Deepin风格的QSpinBox.
Definition: dspinbox.h:17
D_DECL_DEPRECATED void defaultValueChanged(int defaultValue)
默认值发生了变化.
void alertChanged(bool alert)
警告状态发生了变化.