qlcdnumber.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qlcdnumber.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5class QLCDNumberPrivate : public QFramePrivate-
6{-
7 inline QLCDNumber* q_func() { return static_cast<QLCDNumber *>(q_ptr); } inline const QLCDNumber* q_func() const { return static_cast<const QLCDNumber *>(q_ptr); } friend class QLCDNumber;-
8public:-
9 void init();-
10 void internalSetString(const QString& s);-
11 void drawString(const QString& s, QPainter &, QBitArray * = 0, bool = true);-
12-
13 void drawDigit(const QPoint &, QPainter &, int, char, char = ' ');-
14 void drawSegment(const QPoint &, char, QPainter &, int, bool = false);-
15-
16 int ndigits;-
17 double val;-
18 uint base : 2;-
19 uint smallPoint : 1;-
20 uint fill : 1;-
21 uint shadow : 1;-
22 QString digitStr;-
23 QBitArray points;-
24};-
25static QString int2string(int num, int base, int ndigits, bool *oflow)-
26{-
27 QString s;-
28 bool negative;-
29 if (num < 0
num < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
30 negative = true;-
31 num = -num;-
32 }
never executed: end of block
else {
0
33 negative = false;-
34 }
never executed: end of block
0
35 switch(base) {-
36 case
never executed: case QLCDNumber::Hex:
QLCDNumber::Hex:
never executed: case QLCDNumber::Hex:
0
37 s = QString::asprintf("%*x", ndigits, num);-
38 break;
never executed: break;
0
39 case
never executed: case QLCDNumber::Dec:
QLCDNumber::Dec:
never executed: case QLCDNumber::Dec:
0
40 s = QString::asprintf("%*i", ndigits, num);-
41 break;
never executed: break;
0
42 case
never executed: case QLCDNumber::Oct:
QLCDNumber::Oct:
never executed: case QLCDNumber::Oct:
0
43 s = QString::asprintf("%*o", ndigits, num);-
44 break;
never executed: break;
0
45 case
never executed: case QLCDNumber::Bin:
QLCDNumber::Bin:
never executed: case QLCDNumber::Bin:
0
46 {-
47 char buf[42];-
48 char *p = &buf[41];-
49 uint n = num;-
50 int len = 0;-
51 *p = '\0';-
52 do {-
53 *--p = (char)((n&1)+'0');-
54 n >>= 1;-
55 len++;-
56 }
never executed: end of block
while (n != 0
n != 0Description
TRUEnever evaluated
FALSEnever evaluated
);
0
57 len = ndigits - len;-
58 if (len > 0
len > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
59 s.fill(QLatin1Char(' '), len);
never executed: s.fill(QLatin1Char(' '), len);
0
60 s += QString::fromLatin1(p);-
61 }-
62 break;
never executed: break;
0
63 }-
64 if (negative
negativeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 for (int i=0; i<(int)s.length()
i<(int)s.length()Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
66 if (s[i] != QLatin1Char(' ')
s[i] != QLatin1Char(' ')Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 if (i != 0
i != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
68 s[i-1] = QLatin1Char('-');-
69 }
never executed: end of block
else {
0
70 s.insert(0, QLatin1Char('-'));-
71 }
never executed: end of block
0
72 break;
never executed: break;
0
73 }-
74 }
never executed: end of block
0
75 }
never executed: end of block
0
76 if (oflow
oflowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
77 *
never executed: *oflow = (int)s.length() > ndigits;
oflow = (int)s.length() > ndigits;
never executed: *oflow = (int)s.length() > ndigits;
0
78 return
never executed: return s;
s;
never executed: return s;
0
79}-
80-
81-
82static QString double2string(double num, int base, int ndigits, bool *oflow)-
83{-
84 QString s;-
85 if (base != QLCDNumber::Dec
base != QLCDNumber::DecDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 bool of = num >= 2147483648.0
num >= 2147483648.0Description
TRUEnever evaluated
FALSEnever evaluated
|| num < -2147483648.0
num < -2147483648.0Description
TRUEnever evaluated
FALSEnever evaluated
;
0
87 if (of
ofDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
88 if (oflow
oflowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
89 *
never executed: *oflow = true;
oflow = true;
never executed: *oflow = true;
0
90 return
never executed: return s;
s;
never executed: return s;
0
91 }-
92 s = int2string((int)num, base, ndigits, 0);-
93 }
never executed: end of block
else {
0
94 int nd = ndigits;-
95 do {-
96 s = QString::asprintf("%*.*g", ndigits, nd, num);-
97 int i = s.indexOf(QLatin1Char('e'));-
98 if (i > 0
i > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& s[i+1]==QLatin1Char('+')
s[i+1]==QLatin1Char('+')Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
99 s[i] = QLatin1Char(' ');-
100 s[i+1] = QLatin1Char('e');-
101 }
never executed: end of block
0
102 }
never executed: end of block
while (nd--
nd--Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(int)s.length() > ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
int)s.length() > ndigits
(int)s.length() > ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
103 }
never executed: end of block
0
104 if (oflow
oflowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
105 *
never executed: *oflow = (int)s.length() > ndigits;
oflow = (int)s.length() > ndigits;
never executed: *oflow = (int)s.length() > ndigits;
0
106 return
never executed: return s;
s;
never executed: return s;
0
107}-
108-
109-
110static const char *getSegments(char ch)-
111{-
112 static const char segments[30][8] =-
113 { { 0, 1, 2, 4, 5, 6,99, 0},-
114 { 2, 5,99, 0, 0, 0, 0, 0},-
115 { 0, 2, 3, 4, 6,99, 0, 0},-
116 { 0, 2, 3, 5, 6,99, 0, 0},-
117 { 1, 2, 3, 5,99, 0, 0, 0},-
118 { 0, 1, 3, 5, 6,99, 0, 0},-
119 { 0, 1, 3, 4, 5, 6,99, 0},-
120 { 0, 2, 5,99, 0, 0, 0, 0},-
121 { 0, 1, 2, 3, 4, 5, 6,99},-
122 { 0, 1, 2, 3, 5, 6,99, 0},-
123 { 3,99, 0, 0, 0, 0, 0, 0},-
124 { 7,99, 0, 0, 0, 0, 0, 0},-
125 { 0, 1, 2, 3, 4, 5,99, 0},-
126 { 1, 3, 4, 5, 6,99, 0, 0},-
127 { 0, 1, 4, 6,99, 0, 0, 0},-
128 { 2, 3, 4, 5, 6,99, 0, 0},-
129 { 0, 1, 3, 4, 6,99, 0, 0},-
130 { 0, 1, 3, 4,99, 0, 0, 0},-
131 { 1, 3, 4, 5,99, 0, 0, 0},-
132 { 1, 2, 3, 4, 5,99, 0, 0},-
133 { 1, 4, 6,99, 0, 0, 0, 0},-
134 { 3, 4, 5, 6,99, 0, 0, 0},-
135 { 0, 1, 2, 3, 4,99, 0, 0},-
136 { 3, 4,99, 0, 0, 0, 0, 0},-
137 { 4, 5, 6,99, 0, 0, 0, 0},-
138 { 1, 2, 4, 5, 6,99, 0, 0},-
139 { 1, 2, 3, 5, 6,99, 0, 0},-
140 { 8, 9,99, 0, 0, 0, 0, 0},-
141 { 0, 1, 2, 3,99, 0, 0, 0},-
142 {99, 0, 0, 0, 0, 0, 0, 0} };-
143-
144 if (ch >= '0'
ch >= '0'Description
TRUEnever evaluated
FALSEnever evaluated
&& ch <= '9'
ch <= '9'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
145 return
never executed: return segments[ch - '0'];
segments[ch - '0'];
never executed: return segments[ch - '0'];
0
146 if (ch >= 'A'
ch >= 'A'Description
TRUEnever evaluated
FALSEnever evaluated
&& ch <= 'F'
ch <= 'F'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
147 return
never executed: return segments[ch - 'A' + 12];
segments[ch - 'A' + 12];
never executed: return segments[ch - 'A' + 12];
0
148 if (ch >= 'a'
ch >= 'a'Description
TRUEnever evaluated
FALSEnever evaluated
&& ch <= 'f'
ch <= 'f'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
149 return
never executed: return segments[ch - 'a' + 12];
segments[ch - 'a' + 12];
never executed: return segments[ch - 'a' + 12];
0
150-
151 int n;-
152 switch (ch) {-
153 case
never executed: case '-':
'-':
never executed: case '-':
0
154 n = 10; break;
never executed: break;
0
155 case
never executed: case 'O':
'O':
never executed: case 'O':
0
156 n = 0; break;
never executed: break;
0
157 case
never executed: case 'g':
'g':
never executed: case 'g':
0
158 n = 9; break;
never executed: break;
0
159 case
never executed: case '.':
'.':
never executed: case '.':
0
160 n = 11; break;
never executed: break;
0
161 case
never executed: case 'h':
'h':
never executed: case 'h':
0
162 n = 18; break;
never executed: break;
0
163 case
never executed: case 'H':
'H':
never executed: case 'H':
0
164 n = 19; break;
never executed: break;
0
165 case
never executed: case 'l':
'l':
never executed: case 'l':
0
166 case
never executed: case 'L':
'L':
never executed: case 'L':
0
167 n = 20; break;
never executed: break;
0
168 case
never executed: case 'o':
'o':
never executed: case 'o':
0
169 n = 21; break;
never executed: break;
0
170 case
never executed: case 'p':
'p':
never executed: case 'p':
0
171 case
never executed: case 'P':
'P':
never executed: case 'P':
0
172 n = 22; break;
never executed: break;
0
173 case
never executed: case 'r':
'r':
never executed: case 'r':
0
174 case
never executed: case 'R':
'R':
never executed: case 'R':
0
175 n = 23; break;
never executed: break;
0
176 case
never executed: case 's':
's':
never executed: case 's':
0
177 case
never executed: case 'S':
'S':
never executed: case 'S':
0
178 n = 5; break;
never executed: break;
0
179 case
never executed: case 'u':
'u':
never executed: case 'u':
0
180 n = 24; break;
never executed: break;
0
181 case
never executed: case 'U':
'U':
never executed: case 'U':
0
182 n = 25; break;
never executed: break;
0
183 case
never executed: case 'y':
'y':
never executed: case 'y':
0
184 case
never executed: case 'Y':
'Y':
never executed: case 'Y':
0
185 n = 26; break;
never executed: break;
0
186 case
never executed: case ':':
':':
never executed: case ':':
0
187 n = 27; break;
never executed: break;
0
188 case
never executed: case '\'':
'\'':
never executed: case '\'':
0
189 n = 28; break;
never executed: break;
0
190 default
never executed: default:
:
never executed: default:
0
191 n = 29; break;
never executed: break;
0
192 }-
193 return
never executed: return segments[n];
segments[n];
never executed: return segments[n];
0
194}-
195QLCDNumber::QLCDNumber(QWidget *parent)-
196 : QFrame(*new QLCDNumberPrivate, parent)-
197{-
198 QLCDNumberPrivate * const d = d_func();-
199 d->ndigits = 5;-
200 d->init();-
201}
never executed: end of block
0
202QLCDNumber::QLCDNumber(uint numDigits, QWidget *parent)-
203 : QFrame(*new QLCDNumberPrivate, parent)-
204{-
205 QLCDNumberPrivate * const d = d_func();-
206 d->ndigits = numDigits;-
207 d->init();-
208}
never executed: end of block
0
209-
210void QLCDNumberPrivate::init()-
211{-
212 QLCDNumber * const q = q_func();-
213-
214 q->setFrameStyle(QFrame::Box | QFrame::Raised);-
215 val = 0;-
216 base = QLCDNumber::Dec;-
217 smallPoint = false;-
218 q->setDigitCount(ndigits);-
219 q->setSegmentStyle(QLCDNumber::Filled);-
220 q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));-
221}
never executed: end of block
0
222-
223-
224-
225-
226-
227QLCDNumber::~QLCDNumber()-
228{-
229}-
230void QLCDNumber::setDigitCount(int numDigits)-
231{-
232 QLCDNumberPrivate * const d = d_func();-
233 if (__builtin_expect(!!(numDigits > 99), false)
__builtin_expe... > 99), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
234 QMessageLogger(__FILE__, 412, __PRETTY_FUNCTION__).warning("QLCDNumber::setNumDigits: (%s) Max 99 digits allowed",-
235 objectName().toLocal8Bit().constData());-
236 numDigits = 99;-
237 }
never executed: end of block
0
238 if (__builtin_expect(!!(numDigits < 0), false)
__builtin_expe...s < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
239 QMessageLogger(__FILE__, 417, __PRETTY_FUNCTION__).warning("QLCDNumber::setNumDigits: (%s) Min 0 digits allowed",-
240 objectName().toLocal8Bit().constData());-
241 numDigits = 0;-
242 }
never executed: end of block
0
243 if (d->digitStr.isNull()
d->digitStr.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
244 d->ndigits = numDigits;-
245 d->digitStr.fill(QLatin1Char(' '), d->ndigits);-
246 d->points.fill(0, d->ndigits);-
247 d->digitStr[d->ndigits - 1] = QLatin1Char('0');-
248 }
never executed: end of block
else {
0
249 bool doDisplay = d->ndigits == 0;-
250 if (numDigits == d->ndigits
numDigits == d->ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
251 return;
never executed: return;
0
252 int i;-
253 int dif;-
254 if (numDigits > d->ndigits
numDigits > d->ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
255 dif = numDigits - d->ndigits;-
256 QString buf;-
257 buf.fill(QLatin1Char(' '), dif);-
258 d->digitStr.insert(0, buf);-
259 d->points.resize(numDigits);-
260 for (i=numDigits-1; i>=dif
i>=difDescription
TRUEnever evaluated
FALSEnever evaluated
; i--)
0
261 d->points.setBit(i, d->points.testBit(i-dif));
never executed: d->points.setBit(i, d->points.testBit(i-dif));
0
262 for (i=0; i<dif
i<difDescription
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
263 d->points.clearBit(i);
never executed: d->points.clearBit(i);
0
264 }
never executed: end of block
else {
0
265 dif = d->ndigits - numDigits;-
266 d->digitStr = d->digitStr.right(numDigits);-
267 QBitArray tmpPoints = d->points;-
268 d->points.resize(numDigits);-
269 for (i=0; i<(int)numDigits
i<(int)numDigitsDescription
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
270 d->points.setBit(i, tmpPoints.testBit(i+dif));
never executed: d->points.setBit(i, tmpPoints.testBit(i+dif));
0
271 }
never executed: end of block
0
272 d->ndigits = numDigits;-
273 if (doDisplay
doDisplayDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
274 display(value());
never executed: display(value());
0
275 update();-
276 }
never executed: end of block
0
277}-
278-
279-
280-
281-
282int QLCDNumber::digitCount() const-
283{-
284 const QLCDNumberPrivate * const d = d_func();-
285 return
never executed: return d->ndigits;
d->ndigits;
never executed: return d->ndigits;
0
286}-
287bool QLCDNumber::checkOverflow(int num) const-
288{-
289 const QLCDNumberPrivate * const d = d_func();-
290 bool of;-
291 int2string(num, d->base, d->ndigits, &of);-
292 return
never executed: return of;
of;
never executed: return of;
0
293}-
294bool QLCDNumber::checkOverflow(double num) const-
295{-
296 const QLCDNumberPrivate * const d = d_func();-
297 bool of;-
298 double2string(num, d->base, d->ndigits, &of);-
299 return
never executed: return of;
of;
never executed: return of;
0
300}-
301QLCDNumber::Mode QLCDNumber::mode() const-
302{-
303 const QLCDNumberPrivate * const d = d_func();-
304 return
never executed: return (QLCDNumber::Mode) d->base;
(QLCDNumber::Mode) d->base;
never executed: return (QLCDNumber::Mode) d->base;
0
305}-
306-
307void QLCDNumber::setMode(Mode m)-
308{-
309 QLCDNumberPrivate * const d = d_func();-
310 d->base = m;-
311 display(d->val);-
312}
never executed: end of block
0
313double QLCDNumber::value() const-
314{-
315 const QLCDNumberPrivate * const d = d_func();-
316 return
never executed: return d->val;
d->val;
never executed: return d->val;
0
317}-
318-
319-
320-
321-
322-
323-
324void QLCDNumber::display(double num)-
325{-
326 QLCDNumberPrivate * const d = d_func();-
327 d->val = num;-
328 bool of;-
329 QString s = double2string(d->val, d->base, d->ndigits, &of);-
330 if (of
ofDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
331 overflow();
never executed: overflow();
0
332 else-
333 d->internalSetString(s);
never executed: d->internalSetString(s);
0
334}-
335int QLCDNumber::intValue() const-
336{-
337 const QLCDNumberPrivate * const d = d_func();-
338 return
never executed: return qRound(d->val);
qRound(d->val);
never executed: return qRound(d->val);
0
339}-
340-
341-
342-
343-
344-
345-
346-
347void QLCDNumber::display(int num)-
348{-
349 QLCDNumberPrivate * const d = d_func();-
350 d->val = (double)num;-
351 bool of;-
352 QString s = int2string(num, d->base, d->ndigits, &of);-
353 if (of
ofDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
354 overflow();
never executed: overflow();
0
355 else-
356 d->internalSetString(s);
never executed: d->internalSetString(s);
0
357}-
358void QLCDNumber::display(const QString &s)-
359{-
360 QLCDNumberPrivate * const d = d_func();-
361 d->val = 0;-
362 bool ok = false;-
363 double v = s.toDouble(&ok);-
364 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
365 d->val = v;
never executed: d->val = v;
0
366 d->internalSetString(s);-
367}
never executed: end of block
0
368void QLCDNumber::setHexMode()-
369{-
370 setMode(Hex);-
371}
never executed: end of block
0
372void QLCDNumber::setDecMode()-
373{-
374 setMode(Dec);-
375}
never executed: end of block
0
376void QLCDNumber::setOctMode()-
377{-
378 setMode(Oct);-
379}
never executed: end of block
0
380void QLCDNumber::setBinMode()-
381{-
382 setMode(Bin);-
383}
never executed: end of block
0
384void QLCDNumber::setSmallDecimalPoint(bool b)-
385{-
386 QLCDNumberPrivate * const d = d_func();-
387 d->smallPoint = b;-
388 update();-
389}
never executed: end of block
0
390-
391bool QLCDNumber::smallDecimalPoint() const-
392{-
393 const QLCDNumberPrivate * const d = d_func();-
394 return
never executed: return d->smallPoint;
d->smallPoint;
never executed: return d->smallPoint;
0
395}-
396-
397-
398-
399-
400-
401-
402-
403void QLCDNumber::paintEvent(QPaintEvent *)-
404{-
405 QLCDNumberPrivate * const d = d_func();-
406 QPainter p(this);-
407 drawFrame(&p);-
408 p.setRenderHint(QPainter::Antialiasing);-
409 if (d->shadow
d->shadowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
410 p.translate(0.5, 0.5);
never executed: p.translate(0.5, 0.5);
0
411-
412 if (d->smallPoint
d->smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
413 d->drawString(d->digitStr, p, &d->points, false);
never executed: d->drawString(d->digitStr, p, &d->points, false);
0
414 else-
415 d->drawString(d->digitStr, p, 0, false);
never executed: d->drawString(d->digitStr, p, 0, false);
0
416}-
417-
418-
419void QLCDNumberPrivate::internalSetString(const QString& s)-
420{-
421 QLCDNumber * const q = q_func();-
422 QString buffer;-
423 int i;-
424 int len = s.length();-
425 QBitArray newPoints(ndigits);-
426-
427 if (!smallPoint
!smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
428 if (len == ndigits
len == ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
429 buffer = s;
never executed: buffer = s;
0
430 else-
431 buffer = s.right(ndigits).rightJustified(ndigits, QLatin1Char(' '));
never executed: buffer = s.right(ndigits).rightJustified(ndigits, QLatin1Char(' '));
0
432 } else {-
433 int index = -1;-
434 bool lastWasPoint = true;-
435 newPoints.clearBit(0);-
436 for (i=0; i<len
i<lenDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
437 if (s[i] == QLatin1Char('.')
s[i] == QLatin1Char('.')Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
438 if (lastWasPoint
lastWasPointDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
439 if (index == ndigits - 1
index == ndigits - 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
440 break;
never executed: break;
0
441 index++;-
442 buffer[index] = QLatin1Char(' ');-
443 }
never executed: end of block
0
444 newPoints.setBit(index);-
445 lastWasPoint = true;-
446 }
never executed: end of block
else {
0
447 if (index == ndigits - 1
index == ndigits - 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
448 break;
never executed: break;
0
449 index++;-
450 buffer[index] = s[i];-
451 newPoints.clearBit(index);-
452 lastWasPoint = false;-
453 }
never executed: end of block
0
454 }-
455 if (index < ((int) ndigits) - 1
index < ((int) ndigits) - 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
456 for(i=index; i>=0
i>=0Description
TRUEnever evaluated
FALSEnever evaluated
; i--) {
0
457 buffer[ndigits - 1 - index + i] = buffer[i];-
458 newPoints.setBit(ndigits - 1 - index + i,-
459 newPoints.testBit(i));-
460 }
never executed: end of block
0
461 for(i=0; i<ndigits-index-1
i<ndigits-index-1Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
462 buffer[i] = QLatin1Char(' ');-
463 newPoints.clearBit(i);-
464 }
never executed: end of block
0
465 }
never executed: end of block
0
466 }
never executed: end of block
0
467-
468 if (buffer == digitStr
buffer == digitStrDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
469 return;
never executed: return;
0
470-
471 digitStr = buffer;-
472 if (smallPoint
smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
473 points = newPoints;
never executed: points = newPoints;
0
474 q->update();-
475}
never executed: end of block
0
476-
477-
478-
479-
480-
481void QLCDNumberPrivate::drawString(const QString &s, QPainter &p,-
482 QBitArray *newPoints, bool newString)-
483{-
484 QLCDNumber * const q = q_func();-
485 QPoint pos;-
486-
487 int digitSpace = smallPoint
smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
? 2 : 1;
0
488 int xSegLen = q->width()*5/(ndigits*(5 + digitSpace) + digitSpace);-
489 int ySegLen = q->height()*5/12;-
490 int segLen = ySegLen > xSegLen
ySegLen > xSegLenDescription
TRUEnever evaluated
FALSEnever evaluated
? xSegLen : ySegLen;
0
491 int xAdvance = segLen*(5 + digitSpace)/5;-
492 int xOffset = (q->width() - ndigits*xAdvance + segLen/5)/2;-
493 int yOffset = (q->height() - segLen*2)/2;-
494-
495 for (int i=0; i<ndigits
i<ndigitsDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
496 pos = QPoint(xOffset + xAdvance*i, yOffset);-
497 if (newString
newStringDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
498 drawDigit(pos, p, segLen, s[i].toLatin1(), digitStr[i].toLatin1());
never executed: drawDigit(pos, p, segLen, s[i].toLatin1(), digitStr[i].toLatin1());
0
499 else-
500 drawDigit(pos, p, segLen, s[i].toLatin1());
never executed: drawDigit(pos, p, segLen, s[i].toLatin1());
0
501 if (newPoints
newPointsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
502 char newPoint = newPoints->testBit(i)
newPoints->testBit(i)Description
TRUEnever evaluated
FALSEnever evaluated
? '.' : ' ';
0
503 if (newString
newStringDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
504 char oldPoint = points.testBit(i)
points.testBit(i)Description
TRUEnever evaluated
FALSEnever evaluated
? '.' : ' ';
0
505 drawDigit(pos, p, segLen, newPoint, oldPoint);-
506 }
never executed: end of block
else {
0
507 drawDigit(pos, p, segLen, newPoint);-
508 }
never executed: end of block
0
509 }-
510 }
never executed: end of block
0
511 if (newString
newStringDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
512 digitStr = s;-
513 digitStr.truncate(ndigits);-
514 if (newPoints
newPointsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
515 points = *newPoints;
never executed: points = *newPoints;
0
516 }
never executed: end of block
0
517}
never executed: end of block
0
518-
519-
520-
521-
522-
523-
524void QLCDNumberPrivate::drawDigit(const QPoint &pos, QPainter &p, int segLen,-
525 char newCh, char oldCh)-
526{-
527-
528-
529-
530 char updates[18][2];-
531-
532 int nErases;-
533 int nUpdates;-
534 const char *segs;-
535 int i,j;-
536-
537 const char erase = 0;-
538 const char draw = 1;-
539 const char leaveAlone = 2;-
540-
541 segs = getSegments(oldCh);-
542 for (nErases=0; segs[nErases] != 99
segs[nErases] != 99Description
TRUEnever evaluated
FALSEnever evaluated
; nErases++) {
0
543 updates[nErases][0] = erase;-
544 updates[nErases][1] = segs[nErases];-
545 }
never executed: end of block
0
546 nUpdates = nErases;-
547 segs = getSegments(newCh);-
548 for(i = 0 ; segs[i] != 99
segs[i] != 99Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
549 for (j=0; j<nErases
j<nErasesDescription
TRUEnever evaluated
FALSEnever evaluated
; j++)
0
550 if (segs[i] == updates[j][1]
segs[i] == updates[j][1]Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
551 updates[j][0] = leaveAlone;-
552 break;
never executed: break;
0
553 }-
554 if (j == nErases
j == nErasesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
555 updates[nUpdates][0] = draw;-
556 updates[nUpdates][1] = segs[i];-
557 nUpdates++;-
558 }
never executed: end of block
0
559 }
never executed: end of block
0
560 for (i=0; i<nUpdates
i<nUpdatesDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
561 if (updates[i][0] == draw
updates[i][0] == drawDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
562 drawSegment(pos, updates[i][1], p, segLen);
never executed: drawSegment(pos, updates[i][1], p, segLen);
0
563 if (updates[i][0] == erase
updates[i][0] == eraseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
564 drawSegment(pos, updates[i][1], p, segLen, true);
never executed: drawSegment(pos, updates[i][1], p, segLen, true);
0
565 }
never executed: end of block
0
566}
never executed: end of block
0
567-
568-
569static void addPoint(QPolygon &a, const QPoint &p)-
570{-
571 uint n = a.size();-
572 a.resize(n + 1);-
573 a.setPoint(n, p);-
574}
never executed: end of block
0
575-
576-
577-
578-
579-
580void QLCDNumberPrivate::drawSegment(const QPoint &pos, char segmentNo, QPainter &p,-
581 int segLen, bool erase)-
582{-
583 QLCDNumber * const q = q_func();-
584 QPoint ppt;-
585 QPoint pt = pos;-
586 int width = segLen/5;-
587-
588 const QPalette &pal = q->palette();-
589 QColor lightColor,darkColor,fgColor;-
590 if (erase
eraseDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
591 lightColor = pal.color(q->backgroundRole());-
592 darkColor = lightColor;-
593 fgColor = lightColor;-
594 }
never executed: end of block
else {
0
595 lightColor = pal.light().color();-
596 darkColor = pal.dark().color();-
597 fgColor = pal.color(q->foregroundRole());-
598 }
never executed: end of block
0
599-
600-
601-
602-
603-
604-
605 if (fill
fillDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
606 QPolygon a(0);-
607-
608-
609 switch (segmentNo) {-
610 case
never executed: case 0 :
0 :
never executed: case 0 :
0
611 ppt = pt;-
612 ;-
613 addPoint(a, QPoint(pt.x() + (segLen - 1),pt.y() + (0)));-
614 ;-
615 addPoint(a, QPoint(pt.x() + (segLen - width - 1),pt.y() + (width)));-
616 addPoint(a, QPoint(pt.x() + (width),pt.y() + (width)));-
617 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
618 break;
never executed: break;
0
619 case
never executed: case 1 :
1 :
never executed: case 1 :
0
620 pt += QPoint(0 , 1);-
621 ppt = pt;-
622 ;-
623 addPoint(a, QPoint(pt.x() + (width),pt.y() + (width)));-
624 ;-
625 addPoint(a, QPoint(pt.x() + (width),pt.y() + (segLen - width/2 - 2)));-
626 addPoint(a, QPoint(pt.x() + (0),pt.y() + (segLen - 2)));-
627 ;-
628 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
629 break;
never executed: break;
0
630 case
never executed: case 2 :
2 :
never executed: case 2 :
0
631 pt += QPoint(segLen - 1 , 1);-
632 ppt = pt;-
633 ;-
634 addPoint(a, QPoint(pt.x() + (0),pt.y() + (segLen - 2)));-
635 addPoint(a, QPoint(pt.x() + (-width),pt.y() + (segLen - width/2 - 2)));-
636 ;-
637 addPoint(a, QPoint(pt.x() + (-width),pt.y() + (width)));-
638 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
639 break;
never executed: break;
0
640 case
never executed: case 3 :
3 :
never executed: case 3 :
0
641 pt += QPoint(0 , segLen);-
642 ppt = pt;-
643 ;-
644 addPoint(a, QPoint(pt.x() + (width),pt.y() + (-width/2)));-
645 addPoint(a, QPoint(pt.x() + (segLen - width - 1),pt.y() + (-width/2)));-
646 addPoint(a, QPoint(pt.x() + (segLen - 1),pt.y() + (0)));-
647 ;-
648 if (width & 1
width & 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
649 addPoint(a, QPoint(pt.x() + (segLen - width - 3),pt.y() + (width/2 + 1)));-
650 addPoint(a, QPoint(pt.x() + (width + 2),pt.y() + (width/2 + 1)));-
651 }
never executed: end of block
else {
0
652 addPoint(a, QPoint(pt.x() + (segLen - width - 1),pt.y() + (width/2)));-
653 addPoint(a, QPoint(pt.x() + (width),pt.y() + (width/2)));-
654 }
never executed: end of block
0
655 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
656 break;
never executed: break;
0
657 case
never executed: case 4 :
4 :
never executed: case 4 :
0
658 pt += QPoint(0 , segLen + 1);-
659 ppt = pt;-
660 ;-
661 addPoint(a, QPoint(pt.x() + (width),pt.y() + (width/2)));-
662 ;-
663 addPoint(a, QPoint(pt.x() + (width),pt.y() + (segLen - width - 2)));-
664 addPoint(a, QPoint(pt.x() + (0),pt.y() + (segLen - 2)));-
665 ;-
666 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
667 break;
never executed: break;
0
668 case
never executed: case 5 :
5 :
never executed: case 5 :
0
669 pt += QPoint(segLen - 1 , segLen + 1);-
670 ppt = pt;-
671 ;-
672 addPoint(a, QPoint(pt.x() + (0),pt.y() + (segLen - 2)));-
673 addPoint(a, QPoint(pt.x() + (-width),pt.y() + (segLen - width - 2)));-
674 ;-
675 addPoint(a, QPoint(pt.x() + (-width),pt.y() + (width/2)));-
676 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
677 break;
never executed: break;
0
678 case
never executed: case 6 :
6 :
never executed: case 6 :
0
679 pt += QPoint(0 , segLen*2);-
680 ppt = pt;-
681 ;-
682 addPoint(a, QPoint(pt.x() + (width),pt.y() + (-width)));-
683 addPoint(a, QPoint(pt.x() + (segLen - width - 1),pt.y() + (-width)));-
684 addPoint(a, QPoint(pt.x() + (segLen - 1),pt.y() + (0)));-
685 ;-
686 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
687 break;
never executed: break;
0
688 case
never executed: case 7 :
7 :
never executed: case 7 :
0
689 if (smallPoint
smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
690 pt += QPoint(segLen + width/2 , segLen*2);
never executed: pt += QPoint(segLen + width/2 , segLen*2);
0
691 else-
692 pt += QPoint(segLen/2 , segLen*2);
never executed: pt += QPoint(segLen/2 , segLen*2);
0
693 ppt = pt;-
694 ;-
695 addPoint(a, QPoint(pt.x() + (width),pt.y() + (0)));-
696 addPoint(a, QPoint(pt.x() + (width),pt.y() + (-width)));-
697 ;-
698 addPoint(a, QPoint(pt.x() + (0),pt.y() + (-width)));-
699 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
700 break;
never executed: break;
0
701 case
never executed: case 8 :
8 :
never executed: case 8 :
0
702 pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width);-
703 ppt = pt;-
704 ;-
705 addPoint(a, QPoint(pt.x() + (width),pt.y() + (0)));-
706 addPoint(a, QPoint(pt.x() + (width),pt.y() + (-width)));-
707 ;-
708 addPoint(a, QPoint(pt.x() + (0),pt.y() + (-width)));-
709 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
710 break;
never executed: break;
0
711 case
never executed: case 9 :
9 :
never executed: case 9 :
0
712 pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width);-
713 ppt = pt;-
714 ;-
715 addPoint(a, QPoint(pt.x() + (width),pt.y() + (0)));-
716 addPoint(a, QPoint(pt.x() + (width),pt.y() + (-width)));-
717 ;-
718 addPoint(a, QPoint(pt.x() + (0),pt.y() + (-width)));-
719 addPoint(a, QPoint(pt.x() + (0),pt.y() + (0)));-
720 break;
never executed: break;
0
721 default
never executed: default :
:
never executed: default :
0
722 QMessageLogger(__FILE__, 1028, __PRETTY_FUNCTION__).warning("QLCDNumber::drawSegment: (%s) Illegal segment id: %d\n",-
723 q->objectName().toLocal8Bit().constData(), segmentNo);-
724 }
never executed: end of block
0
725-
726 p.setPen(Qt::NoPen);-
727 p.setBrush(fgColor);-
728 p.drawPolygon(a);-
729 p.setBrush(Qt::NoBrush);-
730-
731 pt = pos;-
732 }
never executed: end of block
0
733 if (shadow
shadowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
734 switch (segmentNo) {-
735 case
never executed: case 0 :
0 :
never executed: case 0 :
0
736 ppt = pt;-
737 p.setPen(lightColor);-
738 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - 1), pt.y()+(0)); ppt = QPoint(pt.x()+(segLen - 1), pt.y()+(0));-
739 p.setPen(darkColor);-
740 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - width - 1), pt.y()+(width)); ppt = QPoint(pt.x()+(segLen - width - 1), pt.y()+(width));-
741 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(width)); ppt = QPoint(pt.x()+(width), pt.y()+(width));-
742 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
743 break;
never executed: break;
0
744 case
never executed: case 1 :
1 :
never executed: case 1 :
0
745 pt += QPoint(0,1);-
746 ppt = pt;-
747 p.setPen(lightColor);-
748 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(width)); ppt = QPoint(pt.x()+(width), pt.y()+(width));-
749 p.setPen(darkColor);-
750 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(segLen - width/2 - 2)); ppt = QPoint(pt.x()+(width), pt.y()+(segLen - width/2 - 2));-
751 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(segLen - 2)); ppt = QPoint(pt.x()+(0), pt.y()+(segLen - 2));-
752 p.setPen(lightColor);-
753 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
754 break;
never executed: break;
0
755 case
never executed: case 2 :
2 :
never executed: case 2 :
0
756 pt += QPoint(segLen - 1 , 1);-
757 ppt = pt;-
758 p.setPen(darkColor);-
759 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(segLen - 2)); ppt = QPoint(pt.x()+(0), pt.y()+(segLen - 2));-
760 p.drawLine(ppt.x(), ppt.y(), pt.x()+(-width), pt.y()+(segLen - width/2 - 2)); ppt = QPoint(pt.x()+(-width), pt.y()+(segLen - width/2 - 2));-
761 p.setPen(lightColor);-
762 p.drawLine(ppt.x(), ppt.y(), pt.x()+(-width), pt.y()+(width)); ppt = QPoint(pt.x()+(-width), pt.y()+(width));-
763 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
764 break;
never executed: break;
0
765 case
never executed: case 3 :
3 :
never executed: case 3 :
0
766 pt += QPoint(0 , segLen);-
767 ppt = pt;-
768 p.setPen(lightColor);-
769 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(-width/2)); ppt = QPoint(pt.x()+(width), pt.y()+(-width/2));-
770 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - width - 1), pt.y()+(-width/2)); ppt = QPoint(pt.x()+(segLen - width - 1), pt.y()+(-width/2));-
771 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - 1), pt.y()+(0)); ppt = QPoint(pt.x()+(segLen - 1), pt.y()+(0));-
772 p.setPen(darkColor);-
773 if (width & 1
width & 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
774 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - width - 3), pt.y()+(width/2 + 1)); ppt = QPoint(pt.x()+(segLen - width - 3), pt.y()+(width/2 + 1));-
775 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width + 2), pt.y()+(width/2 + 1)); ppt = QPoint(pt.x()+(width + 2), pt.y()+(width/2 + 1));-
776 }
never executed: end of block
else {
0
777 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - width - 1), pt.y()+(width/2)); ppt = QPoint(pt.x()+(segLen - width - 1), pt.y()+(width/2));-
778 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(width/2)); ppt = QPoint(pt.x()+(width), pt.y()+(width/2));-
779 }
never executed: end of block
0
780 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
781 break;
never executed: break;
0
782 case
never executed: case 4 :
4 :
never executed: case 4 :
0
783 pt += QPoint(0 , segLen + 1);-
784 ppt = pt;-
785 p.setPen(lightColor);-
786 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(width/2)); ppt = QPoint(pt.x()+(width), pt.y()+(width/2));-
787 p.setPen(darkColor);-
788 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(segLen - width - 2)); ppt = QPoint(pt.x()+(width), pt.y()+(segLen - width - 2));-
789 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(segLen - 2)); ppt = QPoint(pt.x()+(0), pt.y()+(segLen - 2));-
790 p.setPen(lightColor);-
791 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
792 break;
never executed: break;
0
793 case
never executed: case 5 :
5 :
never executed: case 5 :
0
794 pt += QPoint(segLen - 1 , segLen + 1);-
795 ppt = pt;-
796 p.setPen(darkColor);-
797 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(segLen - 2)); ppt = QPoint(pt.x()+(0), pt.y()+(segLen - 2));-
798 p.drawLine(ppt.x(), ppt.y(), pt.x()+(-width), pt.y()+(segLen - width - 2)); ppt = QPoint(pt.x()+(-width), pt.y()+(segLen - width - 2));-
799 p.setPen(lightColor);-
800 p.drawLine(ppt.x(), ppt.y(), pt.x()+(-width), pt.y()+(width/2)); ppt = QPoint(pt.x()+(-width), pt.y()+(width/2));-
801 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
802 break;
never executed: break;
0
803 case
never executed: case 6 :
6 :
never executed: case 6 :
0
804 pt += QPoint(0 , segLen*2);-
805 ppt = pt;-
806 p.setPen(lightColor);-
807 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(-width)); ppt = QPoint(pt.x()+(width), pt.y()+(-width));-
808 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - width - 1), pt.y()+(-width)); ppt = QPoint(pt.x()+(segLen - width - 1), pt.y()+(-width));-
809 p.drawLine(ppt.x(), ppt.y(), pt.x()+(segLen - 1), pt.y()+(0)); ppt = QPoint(pt.x()+(segLen - 1), pt.y()+(0));-
810 p.setPen(darkColor);-
811 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
812 break;
never executed: break;
0
813 case
never executed: case 7 :
7 :
never executed: case 7 :
0
814 if (smallPoint
smallPointDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
815 pt += QPoint(segLen + width/2 , segLen*2);
never executed: pt += QPoint(segLen + width/2 , segLen*2);
0
816 else-
817 pt += QPoint(segLen/2 , segLen*2);
never executed: pt += QPoint(segLen/2 , segLen*2);
0
818 ppt = pt;-
819 p.setPen(darkColor);-
820 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(0)); ppt = QPoint(pt.x()+(width), pt.y()+(0));-
821 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(-width)); ppt = QPoint(pt.x()+(width), pt.y()+(-width));-
822 p.setPen(lightColor);-
823 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(-width)); ppt = QPoint(pt.x()+(0), pt.y()+(-width));-
824 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
825 break;
never executed: break;
0
826 case
never executed: case 8 :
8 :
never executed: case 8 :
0
827 pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width);-
828 ppt = pt;-
829 p.setPen(darkColor);-
830 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(0)); ppt = QPoint(pt.x()+(width), pt.y()+(0));-
831 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(-width)); ppt = QPoint(pt.x()+(width), pt.y()+(-width));-
832 p.setPen(lightColor);-
833 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(-width)); ppt = QPoint(pt.x()+(0), pt.y()+(-width));-
834 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
835 break;
never executed: break;
0
836 case
never executed: case 9 :
9 :
never executed: case 9 :
0
837 pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width);-
838 ppt = pt;-
839 p.setPen(darkColor);-
840 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(0)); ppt = QPoint(pt.x()+(width), pt.y()+(0));-
841 p.drawLine(ppt.x(), ppt.y(), pt.x()+(width), pt.y()+(-width)); ppt = QPoint(pt.x()+(width), pt.y()+(-width));-
842 p.setPen(lightColor);-
843 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(-width)); ppt = QPoint(pt.x()+(0), pt.y()+(-width));-
844 p.drawLine(ppt.x(), ppt.y(), pt.x()+(0), pt.y()+(0)); ppt = QPoint(pt.x()+(0), pt.y()+(0));-
845 break;
never executed: break;
0
846 default
never executed: default :
:
never executed: default :
0
847 QMessageLogger(__FILE__, 1161, __PRETTY_FUNCTION__).warning("QLCDNumber::drawSegment: (%s) Illegal segment id: %d\n",-
848 q->objectName().toLocal8Bit().constData(), segmentNo);-
849 }
never executed: end of block
0
850-
851-
852-
853-
854}
never executed: end of block
0
855void QLCDNumber::setSegmentStyle(SegmentStyle s)-
856{-
857 QLCDNumberPrivate * const d = d_func();-
858 d->fill = (s == Flat
s == FlatDescription
TRUEnever evaluated
FALSEnever evaluated
|| s == Filled
s == FilledDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
859 d->shadow = (s == Outline
s == OutlineDescription
TRUEnever evaluated
FALSEnever evaluated
|| s == Filled
s == FilledDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
860 update();-
861}
never executed: end of block
0
862-
863QLCDNumber::SegmentStyle QLCDNumber::segmentStyle() const-
864{-
865 const QLCDNumberPrivate * const d = d_func();-
866 ((!(d->fill || d->shadow)) ? qt_assert("d->fill || d->shadow",__FILE__,1201) : qt_noop());-
867 if (!d->fill
!d->fillDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->shadow
d->shadowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
868 return
never executed: return Outline;
Outline;
never executed: return Outline;
0
869 if (d->fill
d->fillDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->shadow
d->shadowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
870 return
never executed: return Filled;
Filled;
never executed: return Filled;
0
871 return
never executed: return Flat;
Flat;
never executed: return Flat;
0
872}-
873-
874-
875-
876-
877QSize QLCDNumber::sizeHint() const-
878{-
879 return
never executed: return QSize(10 + 9 * (digitCount() + (smallDecimalPoint() ? 0 : 1)), 23);
QSize(10 + 9 * (digitCount() + (smallDecimalPoint() ? 0 : 1)), 23);
never executed: return QSize(10 + 9 * (digitCount() + (smallDecimalPoint() ? 0 : 1)), 23);
0
880}-
881-
882-
883bool QLCDNumber::event(QEvent *e)-
884{-
885 return
never executed: return QFrame::event(e);
QFrame::event(e);
never executed: return QFrame::event(e);
0
886}-
887-
888-
889-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9