File indexing completed on 2026-09-14 09:20:52
0001
0002
0003
0004
0005 #ifndef QLCDNUMBER_H
0006 #define QLCDNUMBER_H
0007
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qframe.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013 QT_REQUIRE_CONFIG(lcdnumber);
0014
0015 class QLCDNumberPrivate;
0016 class Q_WIDGETS_EXPORT QLCDNumber : public QFrame
0017 {
0018 Q_OBJECT
0019 Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
0020 Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
0021 Q_PROPERTY(Mode mode READ mode WRITE setMode)
0022 Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
0023 Q_PROPERTY(double value READ value WRITE display)
0024 Q_PROPERTY(int intValue READ intValue WRITE display)
0025
0026 public:
0027 explicit QLCDNumber(QWidget* parent = nullptr);
0028 explicit QLCDNumber(uint numDigits, QWidget* parent = nullptr);
0029 ~QLCDNumber();
0030
0031 enum Mode {
0032 Hex, Dec, Oct, Bin
0033 };
0034 Q_ENUM(Mode)
0035 enum SegmentStyle {
0036 Outline, Filled, Flat
0037 };
0038 Q_ENUM(SegmentStyle)
0039
0040 bool smallDecimalPoint() const;
0041 int digitCount() const;
0042 void setDigitCount(int nDigits);
0043
0044 bool checkOverflow(double num) const;
0045 bool checkOverflow(int num) const;
0046
0047 Mode mode() const;
0048 void setMode(Mode);
0049
0050 SegmentStyle segmentStyle() const;
0051 void setSegmentStyle(SegmentStyle);
0052
0053 double value() const;
0054 int intValue() const;
0055
0056 QSize sizeHint() const override;
0057
0058 public Q_SLOTS:
0059 void display(const QString &str);
0060 void display(int num);
0061 void display(double num);
0062 void setHexMode();
0063 void setDecMode();
0064 void setOctMode();
0065 void setBinMode();
0066 void setSmallDecimalPoint(bool);
0067
0068 Q_SIGNALS:
0069 void overflow();
0070
0071 protected:
0072 bool event(QEvent *e) override;
0073 void paintEvent(QPaintEvent *) override;
0074
0075 public:
0076
0077 private:
0078 Q_DISABLE_COPY(QLCDNumber)
0079 Q_DECLARE_PRIVATE(QLCDNumber)
0080 };
0081
0082 QT_END_NAMESPACE
0083
0084 #endif