8#include "private/qframe_p.h"
140 *--
p = (char)((
n&1)+
'0');
152 for (
int i=0;
i<(int)
s.size();
i++) {
164 *oflow = (int)
s.size() > ndigits;
173 bool of =
num >= 2147483648.0 ||
num < -2147483648.0;
185 if (
i > 0 &&
s[
i+1]==u
'+') {
189 }
while (nd-- && (
int)
s.size() > ndigits);
192 *oflow = (int)
s.size() > ndigits;
200 { { 0, 1, 2, 4, 5, 6,99, 0},
201 { 2, 5,99, 0, 0, 0, 0, 0},
202 { 0, 2, 3, 4, 6,99, 0, 0},
203 { 0, 2, 3, 5, 6,99, 0, 0},
204 { 1, 2, 3, 5,99, 0, 0, 0},
205 { 0, 1, 3, 5, 6,99, 0, 0},
206 { 0, 1, 3, 4, 5, 6,99, 0},
207 { 0, 2, 5,99, 0, 0, 0, 0},
208 { 0, 1, 2, 3, 4, 5, 6,99},
209 { 0, 1, 2, 3, 5, 6,99, 0},
210 { 3,99, 0, 0, 0, 0, 0, 0},
211 { 7,99, 0, 0, 0, 0, 0, 0},
212 { 0, 1, 2, 3, 4, 5,99, 0},
213 { 1, 3, 4, 5, 6,99, 0, 0},
214 { 0, 1, 4, 6,99, 0, 0, 0},
215 { 2, 3, 4, 5, 6,99, 0, 0},
216 { 0, 1, 3, 4, 6,99, 0, 0},
217 { 0, 1, 3, 4,99, 0, 0, 0},
218 { 1, 3, 4, 5,99, 0, 0, 0},
219 { 1, 2, 3, 4, 5,99, 0, 0},
220 { 1, 4, 6,99, 0, 0, 0, 0},
221 { 3, 4, 5, 6,99, 0, 0, 0},
222 { 0, 1, 2, 3, 4,99, 0, 0},
223 { 3, 4,99, 0, 0, 0, 0, 0},
224 { 4, 5, 6,99, 0, 0, 0, 0},
225 { 1, 2, 4, 5, 6,99, 0, 0},
226 { 1, 2, 3, 5, 6,99, 0, 0},
227 { 8, 9,99, 0, 0, 0, 0, 0},
228 { 0, 1, 2, 3,99, 0, 0, 0},
229 {99, 0, 0, 0, 0, 0, 0, 0} };
231 if (
ch >=
'0' &&
ch <=
'9')
233 if (
ch >=
'A' &&
ch <=
'F')
235 if (
ch >=
'a' &&
ch <=
'f')
364 qWarning(
"QLCDNumber::setNumDigits: (%s) Max 99 digits allowed",
369 qWarning(
"QLCDNumber::setNumDigits: (%s) Min 0 digits allowed",
373 if (
d->digitStr.isNull()) {
375 d->digitStr.fill(u
' ',
d->ndigits);
376 d->points.fill(0,
d->ndigits);
377 d->digitStr[
d->ndigits - 1] = u
'0';
379 bool doDisplay =
d->ndigits == 0;
388 d->digitStr.insert(0,
buf);
391 d->points.setBit(
i,
d->points.testBit(
i-dif));
392 for (
i=0;
i<dif;
i++)
393 d->points.clearBit(
i);
400 d->points.setBit(
i, tmpPoints.
testBit(
i+dif));
511 d->internalSetString(
s);
542 d->val = (double)
num;
548 d->internalSetString(
s);
570 double v =
s.toDouble(&
ok);
573 d->internalSetString(
s);
652 return d->smallPoint;
668 p.translate(0.5, 0.5);
671 d->drawString(
d->digitStr,
p, &
d->points,
false);
673 d->drawString(
d->digitStr,
p,
nullptr,
false);
692 bool lastWasPoint =
true;
710 lastWasPoint =
false;
746 int xSegLen =
q->width()*5/(
ndigits*(5 + digitSpace) + digitSpace);
747 int ySegLen =
q->height()*5/12;
748 int segLen = ySegLen > xSegLen ? xSegLen : ySegLen;
749 int xAdvance = segLen*(5 + digitSpace)/5;
750 int xOffset = (
q->width() -
ndigits*xAdvance + segLen/5)/2;
751 int yOffset = (
q->height() - segLen*2)/2;
760 char newPoint = newPoints->
testBit(
i) ?
'.' :
' ';
762 char oldPoint =
points.testBit(
i) ?
'.' :
' ';
783 char newCh,
char oldCh)
795 const char erase = 0;
797 const char leaveAlone = 2;
800 for (nErases=0; segs[nErases] != 99; nErases++) {
801 updates[nErases][0] =
erase;
802 updates[nErases][1] = segs[nErases];
806 for(
i = 0 ; segs[
i] != 99 ;
i++) {
807 for (
j=0;
j<nErases;
j++)
808 if (segs[
i] == updates[
j][1]) {
809 updates[
j][0] = leaveAlone;
813 updates[nUpdates][0] =
draw;
814 updates[nUpdates][1] = segs[
i];
818 for (
i=0;
i<nUpdates;
i++) {
819 if (updates[
i][0] ==
draw)
821 if (updates[
i][0] ==
erase)
839 int segLen,
bool erase)
844 int width = segLen/5;
847 QColor lightColor,darkColor,fgColor;
849 lightColor = pal.
color(
q->backgroundRole());
850 darkColor = lightColor;
851 fgColor = lightColor;
855 fgColor = pal.
color(
q->foregroundRole());
859#define LINETO(X,Y) addPoint(a, QPoint(pt.x() + (X),pt.y() + (Y)))
889 pt +=
QPoint(segLen - 1 , 1);
916 pt +=
QPoint(0 , segLen + 1);
927 pt +=
QPoint(segLen - 1 , segLen + 1);
937 pt +=
QPoint(0 , segLen*2);
950 pt +=
QPoint(segLen/2 , segLen*2);
980 qWarning(
"QLCDNumber::drawSegment: (%s) Illegal segment id: %d\n",
981 q->objectName().toLocal8Bit().constData(), segmentNo);
995#define LINETO(X,Y) p.drawLine(ppt.x(), ppt.y(), pt.x()+(X), pt.y()+(Y)); \
996 ppt = QPoint(pt.x()+(X), pt.y()+(Y))
997#define LIGHT p.setPen(lightColor)
998#define DARK p.setPen(darkColor)
1000 switch (segmentNo) {
1022 pt +=
QPoint(segLen - 1 , 1);
1032 pt +=
QPoint(0 , segLen);
1049 pt +=
QPoint(0 , segLen + 1);
1060 pt +=
QPoint(segLen - 1 , segLen + 1);
1070 pt +=
QPoint(0 , segLen*2);
1083 pt +=
QPoint(segLen/2 , segLen*2);
1113 qWarning(
"QLCDNumber::drawSegment: (%s) Illegal segment id: %d\n",
1114 q->objectName().toLocal8Bit().constData(), segmentNo);
1154 if (!
d->fill &&
d->shadow)
1156 if (
d->fill &&
d->shadow)
1177#include "moc_qlcdnumber.cpp"
bool testBit(qsizetype i) const
Returns true if the bit at index position i is 1; otherwise returns false.
void setBit(qsizetype i)
Sets the bit at index position i to 1.
void clearBit(qsizetype i)
Sets the bit at index position i to 0.
const QColor & color() const
Returns the brush color.
The QColor class provides colors based on RGB, HSV or CMYK values.
The QFrame class is the base class of widgets that can have a frame.
bool event(QEvent *e) override
\reimp
void drawFrame(QPainter *)
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.
void setBinMode()
Calls setMode(Bin).
double value
the displayed value
Mode
This type determines how numbers are shown.
void setOctMode()
Calls setMode(Oct).
QSize sizeHint() const override
\reimp
SegmentStyle segmentStyle
the style of the LCDNumber
bool checkOverflow(double num) const
Returns true if num is too big to be displayed in its entirety; otherwise returns false.
void setSmallDecimalPoint(bool)
SegmentStyle
This type determines the visual appearance of the QLCDNumber widget.
void setHexMode()
Calls setMode(Hex).
void setSegmentStyle(SegmentStyle)
void display(const QString &str)
Displays the number represented by the string s.
bool smallDecimalPoint
the style of the decimal point
bool event(QEvent *e) override
\reimp
void setDigitCount(int nDigits)
Sets the current number of digits to numDigits.
void paintEvent(QPaintEvent *) override
\reimp
void overflow()
This signal is emitted whenever the QLCDNumber is asked to display a too-large number or a too-long s...
void setDecMode()
Calls setMode(Dec).
Mode mode
the current display mode (number base)
int digitCount
the current number of digits displayed
~QLCDNumber()
Destroys the LCD number.
int intValue
the displayed value rounded to the nearest integer
QLCDNumber(QWidget *parent=nullptr)
Constructs an LCD number, sets the number of digits to 5, the base to decimal, the decimal point mode...
QString objectName
the name of this object
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
The QPalette class contains color groups for each widget state.
const QBrush & dark() const
Returns the dark brush of the current color group.
const QBrush & light() const
Returns the light brush of the current color group.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
\inmodule QtCore\reentrant
The QPolygon class provides a list of points using integer precision.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void truncate(qsizetype pos)
Truncates the string at the given position index.
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
Combined button and popup list for selecting options.
qsizetype erase(QByteArray &ba, const T &t)
int qRound(qfloat16 d) noexcept
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)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
static int numDigits(qlonglong n)
myFilter draw(painter, QPoint(0, 0), originalPixmap)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent