QtGui/qlcdnumber.h Source File

qlcdnumber.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QLCDNUMBER_H
43 #define QLCDNUMBER_H
44 
45 #include <QtGui/qframe.h>
46 #include <QtCore/qbitarray.h>
47 
49 
51 
52 QT_MODULE(Gui)
53 
54 #ifndef QT_NO_LCDNUMBER
55 
56 class QLCDNumberPrivate;
57 class Q_GUI_EXPORT QLCDNumber : public QFrame // LCD number widget
58 {
59  Q_OBJECT
61  Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
62  Q_PROPERTY(int numDigits READ numDigits WRITE setNumDigits)
63  Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
64  Q_PROPERTY(Mode mode READ mode WRITE setMode)
65  Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
66  Q_PROPERTY(double value READ value WRITE display)
67  Q_PROPERTY(int intValue READ intValue WRITE display)
68 
69 public:
70  explicit QLCDNumber(QWidget* parent = 0);
71  explicit QLCDNumber(uint numDigits, QWidget* parent = 0);
72  ~QLCDNumber();
73 
74  enum Mode {
75  Hex, Dec, Oct, Bin
76 #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
77  , HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin
78 #endif
79  };
80  enum SegmentStyle {
81  Outline, Filled, Flat
82  };
83 
84  bool smallDecimalPoint() const;
85 #ifdef QT_DEPRECATED
86  QT_DEPRECATED int numDigits() const;
87  QT_DEPRECATED void setNumDigits(int nDigits);
88 #endif
89  int digitCount() const;
90  void setDigitCount(int nDigits);
91 
92  bool checkOverflow(double num) const;
93  bool checkOverflow(int num) const;
94 
95  Mode mode() const;
96  void setMode(Mode);
97 
98  SegmentStyle segmentStyle() const;
99  void setSegmentStyle(SegmentStyle);
100 
101  double value() const;
102  int intValue() const;
103 
104  QSize sizeHint() const;
105 
106 public Q_SLOTS:
107  void display(const QString &str);
108  void display(int num);
109  void display(double num);
110  void setHexMode();
111  void setDecMode();
112  void setOctMode();
113  void setBinMode();
114  void setSmallDecimalPoint(bool);
115 
116 Q_SIGNALS:
117  void overflow();
118 
119 protected:
120  bool event(QEvent *e);
121  void paintEvent(QPaintEvent *);
122 
123 public:
124 #ifdef QT3_SUPPORT
125  QT3_SUPPORT_CONSTRUCTOR QLCDNumber(QWidget* parent, const char* name);
126  QT3_SUPPORT_CONSTRUCTOR QLCDNumber(uint numDigits, QWidget* parent, const char* name);
127 
128  QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
129  QT3_SUPPORT int margin() const
130  { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
131 #endif
132 
133 private:
134  Q_DISABLE_COPY(QLCDNumber)
135  Q_DECLARE_PRIVATE(QLCDNumber)
136 };
137 
138 #endif // QT_NO_LCDNUMBER
139 
141 
143 
144 #endif // QLCDNUMBER_H
GLint mode
Definition: GLee.h:4479
#define QT_END_NAMESPACE
Definition: qglobal.h:128
#define Q_PROPERTY(text)
Definition: qobjectdefs.h:80
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
#define Q_SLOTS
Definition: qobjectdefs.h:71
#define Q_SIGNALS
Definition: qobjectdefs.h:72
void setContentsMargins(int left, int top, int right, int bottom)
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
Definition: qframe.h:55
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
#define Q_OBJECT
Definition: qobjectdefs.h:157
GLuint GLuint num
Definition: GLee.h:7190
GLsizei const GLfloat * value
Definition: GLee.h:1742
Definition: qsize.h:53
GLuint const GLchar * name
Definition: GLee.h:1704
QSize sizeHint() const
void getContentsMargins(int *left, int *top, int *right, int *bottom) const
void paintEvent(QPaintEvent *)
#define QT_END_HEADER
Definition: qglobal.h:142
bool event(QEvent *e)