Changeset 561 for trunk/src/gui/widgets/qlcdnumber.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qlcdnumber.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 75 75 76 76 \ingroup basicwidgets 77 \mainclass 77 78 78 79 79 It can display a number in just about any size. It can display … … 86 86 87 87 QLCDNumber emits the overflow() signal when it is asked to display 88 something beyond its range. The range is set by set NumDigits(),88 something beyond its range. The range is set by setDigitCount(), 89 89 but setSmallDecimalPoint() also influences it. If the display is 90 90 set to hexadecimal, octal or binary, the integer equivalent of the … … 161 161 a too-large number or a too-long string. 162 162 163 It is never emitted by set NumDigits().163 It is never emitted by setDigitCount(). 164 164 */ 165 165 … … 346 346 constructor. 347 347 348 \sa set NumDigits(), setSmallDecimalPoint()348 \sa setDigitCount(), setSmallDecimalPoint() 349 349 */ 350 350 … … 368 368 constructor. 369 369 370 \sa set NumDigits(), setSmallDecimalPoint()370 \sa setDigitCount(), setSmallDecimalPoint() 371 371 */ 372 372 … … 388 388 The \a parent argument is passed to the QFrame constructor. 389 389 390 \sa set NumDigits(), setSmallDecimalPoint()390 \sa setDigitCount(), setSmallDecimalPoint() 391 391 */ 392 392 … … 404 404 numDigits, the base to decimal, the decimal point mode to 'small' 405 405 and the frame style to a raised box. The segmentStyle() is set to 406 \c Outline.406 \c Filled. 407 407 408 408 The \a parent argument is passed to the QFrame constructor. 409 409 410 \sa set NumDigits(), setSmallDecimalPoint()410 \sa setDigitCount(), setSmallDecimalPoint() 411 411 */ 412 412 … … 427 427 base = QLCDNumber::Dec; 428 428 smallPoint = false; 429 q->set NumDigits(ndigits);430 q->setSegmentStyle(QLCDNumber:: Outline);429 q->setDigitCount(ndigits); 430 q->setSegmentStyle(QLCDNumber::Filled); 431 431 q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); 432 432 } … … 442 442 443 443 /*! 444 \deprecated 444 445 \property QLCDNumber::numDigits 446 \brief the current number of digits displayed 447 \sa digitCount 448 */ 449 450 void QLCDNumber::setNumDigits(int numDigits) 451 { 452 setDigitCount(numDigits); 453 } 454 455 /*! 456 \since 4.6 457 \property QLCDNumber::digitCount 445 458 \brief the current number of digits displayed 446 459 … … 454 467 */ 455 468 456 void QLCDNumber::setNumDigits(int numDigits) 469 /*! 470 Sets the current number of digits to \a numDigits. Must 471 be in the range 0..99. 472 */ 473 void QLCDNumber::setDigitCount(int numDigits) 457 474 { 458 475 Q_D(QLCDNumber); … … 471 488 d->digitStr.fill(QLatin1Char(' '), d->ndigits); 472 489 d->points.fill(0, d->ndigits); 473 d->digitStr[d->ndigits - 1] = QLatin1Char('0'); 490 d->digitStr[d->ndigits - 1] = QLatin1Char('0'); // "0" is the default number 474 491 } else { 475 492 bool doDisplay = d->ndigits == 0; … … 510 527 511 528 /*! 529 Returns the current number of digits. 530 */ 531 int QLCDNumber::digitCount() const 532 { 533 Q_D(const QLCDNumber); 534 return d->ndigits; 535 } 536 537 /*! 512 538 \overload 513 539 … … 515 541 otherwise returns false. 516 542 517 \sa display(), numDigits(), smallDecimalPoint()543 \sa display(), digitCount(), smallDecimalPoint() 518 544 */ 519 545 … … 531 557 otherwise returns false. 532 558 533 \sa display(), numDigits(), smallDecimalPoint()559 \sa display(), digitCount(), smallDecimalPoint() 534 560 */ 535 561 … … 757 783 QPainter p(this); 758 784 drawFrame(&p); 785 p.setRenderHint(QPainter::Antialiasing); 786 if (d->shadow) 787 p.translate(0.5, 0.5); 788 759 789 if (d->smallPoint) 760 790 d->drawString(d->digitStr, p, &d->points, false); … … 1071 1101 } 1072 1102 // End exact copy 1073 p.setPen( fgColor);1103 p.setPen(Qt::NoPen); 1074 1104 p.setBrush(fgColor); 1075 1105 p.drawPolygon(a); … … 1219 1249 \row \i \c Outline 1220 1250 \i Produces raised segments filled with the background color 1251 \row \i \c Filled 1221 1252 (this is the default). 1222 \row \i \c Filled1223 1253 \i Produces raised segments filled with the foreground color. 1224 1254 \row \i \c Flat … … 1253 1283 QSize QLCDNumber::sizeHint() const 1254 1284 { 1255 return QSize(10 + 9 * ( numDigits() + (smallDecimalPoint() ? 0 : 1)), 23);1285 return QSize(10 + 9 * (digitCount() + (smallDecimalPoint() ? 0 : 1)), 23); 1256 1286 } 1257 1287 … … 1272 1302 /*! 1273 1303 \fn int QLCDNumber::margin() const 1274 Returns the wi th of thethe margin around the contents of the widget.1304 Returns the width of the margin around the contents of the widget. 1275 1305 1276 1306 Use QWidget::getContentsMargins() instead.
Note:
See TracChangeset
for help on using the changeset viewer.