Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlcdnumber.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLCDNUMBER_H
5#define QLCDNUMBER_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qframe.h>
9
11
13
15class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget
16{
18 Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
19 Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
20 Q_PROPERTY(Mode mode READ mode WRITE setMode)
21 Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
22 Q_PROPERTY(double value READ value WRITE display)
23 Q_PROPERTY(int intValue READ intValue WRITE display)
24
25public:
26 explicit QLCDNumber(QWidget* parent = nullptr);
27 explicit QLCDNumber(uint numDigits, QWidget* parent = nullptr);
28 ~QLCDNumber();
29
30 enum Mode {
31 Hex, Dec, Oct, Bin
32 };
35 Outline, Filled, Flat
36 };
37 Q_ENUM(SegmentStyle)
38
39 bool smallDecimalPoint() const;
40 int digitCount() const;
41 void setDigitCount(int nDigits);
42
43 bool checkOverflow(double num) const;
44 bool checkOverflow(int num) const;
45
46 Mode mode() const;
47 void setMode(Mode);
48
49 SegmentStyle segmentStyle() const;
50 void setSegmentStyle(SegmentStyle);
51
52 double value() const;
53 int intValue() const;
54
55 QSize sizeHint() const override;
56
57public Q_SLOTS:
58 void display(const QString &str);
59 void display(int num);
60 void display(double num);
61 void setHexMode();
62 void setDecMode();
63 void setOctMode();
64 void setBinMode();
65 void setSmallDecimalPoint(bool);
66
68 void overflow();
69
70protected:
71 bool event(QEvent *e) override;
72 void paintEvent(QPaintEvent *) override;
73
74public:
75
76private:
77 Q_DISABLE_COPY(QLCDNumber)
78 Q_DECLARE_PRIVATE(QLCDNumber)
79};
80
82
83#endif // QLCDNUMBER_H
\inmodule QtCore
Definition qcoreevent.h:45
The QFrame class is the base class of widgets that can have a frame.
Definition qframe.h:17
The QLCDNumber widget displays a number with LCD-like digits.
Definition qlcdnumber.h:16
Mode
This type determines how numbers are shown.
Definition qlcdnumber.h:30
SegmentStyle
This type determines the visual appearance of the QLCDNumber widget.
Definition qlcdnumber.h:34
void overflow()
This signal is emitted whenever the QLCDNumber is asked to display a too-large number or a too-long s...
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QString str
[2]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
static qsizetype digitCount(QStringView str)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum mode
struct _cl_event * event
GLuint num
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:34
static int numDigits(qlonglong n)
#define explicit