Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QLCDNUMBER_H
6#define QLCDNUMBER_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qframe.h>
10
12
14
16class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget
17{
18 Q_OBJECT
19 Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
20 Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
21 Q_PROPERTY(Mode mode READ mode WRITE setMode)
22 Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
23 Q_PROPERTY(double value READ value WRITE display)
24 Q_PROPERTY(int intValue READ intValue WRITE display)
25
26public:
27 explicit QLCDNumber(QWidget* parent = nullptr);
28 explicit QLCDNumber(uint numDigits, QWidget* parent = nullptr);
29 ~QLCDNumber();
30
31 enum Mode {
32 Hex, Dec, Oct, Bin
33 };
34 Q_ENUM(Mode)
35 enum SegmentStyle {
36 Outline, Filled, Flat
37 };
38 Q_ENUM(SegmentStyle)
39
40 bool smallDecimalPoint() const;
41 int digitCount() const;
42 void setDigitCount(int nDigits);
43
44 bool checkOverflow(double num) const;
45 bool checkOverflow(int num) const;
46
47 Mode mode() const;
48 void setMode(Mode);
49
50 SegmentStyle segmentStyle() const;
51 void setSegmentStyle(SegmentStyle);
52
53 double value() const;
54 int intValue() const;
55
56 QSize sizeHint() const override;
57
58public Q_SLOTS:
59 void display(const QString &str);
60 void display(int num);
61 void display(double num);
62 void setHexMode();
63 void setDecMode();
64 void setOctMode();
65 void setBinMode();
66 void setSmallDecimalPoint(bool);
67
68Q_SIGNALS:
69 void overflow();
70
71protected:
72 bool event(QEvent *e) override;
73 void paintEvent(QPaintEvent *) override;
74
75public:
76
77private:
78 Q_DISABLE_COPY(QLCDNumber)
79 Q_DECLARE_PRIVATE(QLCDNumber)
80};
81
82QT_END_NAMESPACE
83
84#endif // QLCDNUMBER_H
\inmodule QtCore
Definition qbitarray.h:13
void drawString(const QString &s, QPainter &, QBitArray *=nullptr, bool=true)
void drawDigit(const QPoint &, QPainter &, int, char, char=' ')
void internalSetString(const QString &s)
void drawSegment(const QPoint &, char, QPainter &, int, bool=false)
The QLCDNumber widget displays a number with LCD-like digits.
Definition qlcdnumber.h:17
The QPolygon class provides a list of points using integer precision.
Definition qpolygon.h:23
static const char * getSegments(char ch)
static void addPoint(QPolygon &a, const QPoint &p)
static QString int2string(int num, int base, int ndigits, bool *oflow)
static QString double2string(double num, int base, int ndigits, bool *oflow)
#define LIGHT
#define LINETO(X, Y)
#define DARK
QT_REQUIRE_CONFIG(thread)