Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qlcdnumber.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    7575
    7676    \ingroup basicwidgets
    77     \mainclass
     77
    7878
    7979    It can display a number in just about any size. It can display
     
    8686
    8787    QLCDNumber emits the overflow() signal when it is asked to display
    88     something beyond its range. The range is set by setNumDigits(),
     88    something beyond its range. The range is set by setDigitCount(),
    8989    but setSmallDecimalPoint() also influences it. If the display is
    9090    set to hexadecimal, octal or binary, the integer equivalent of the
     
    161161    a too-large number or a too-long string.
    162162
    163     It is never emitted by setNumDigits().
     163    It is never emitted by setDigitCount().
    164164*/
    165165
     
    346346    constructor.
    347347
    348     \sa setNumDigits(), setSmallDecimalPoint()
     348    \sa setDigitCount(), setSmallDecimalPoint()
    349349*/
    350350
     
    368368    constructor.
    369369
    370     \sa setNumDigits(), setSmallDecimalPoint()
     370    \sa setDigitCount(), setSmallDecimalPoint()
    371371*/
    372372
     
    388388    The \a parent argument is passed to the QFrame constructor.
    389389
    390     \sa setNumDigits(), setSmallDecimalPoint()
     390    \sa setDigitCount(), setSmallDecimalPoint()
    391391*/
    392392
     
    404404    numDigits, the base to decimal, the decimal point mode to 'small'
    405405    and the frame style to a raised box. The segmentStyle() is set to
    406     \c Outline.
     406    \c Filled.
    407407
    408408    The \a parent argument is passed to the QFrame constructor.
    409409
    410     \sa setNumDigits(), setSmallDecimalPoint()
     410    \sa setDigitCount(), setSmallDecimalPoint()
    411411*/
    412412
     
    427427    base       = QLCDNumber::Dec;
    428428    smallPoint = false;
    429     q->setNumDigits(ndigits);
    430     q->setSegmentStyle(QLCDNumber::Outline);
     429    q->setDigitCount(ndigits);
     430    q->setSegmentStyle(QLCDNumber::Filled);
    431431    q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
    432432}
     
    442442
    443443/*!
     444    \deprecated
    444445    \property QLCDNumber::numDigits
     446    \brief the current number of digits displayed
     447    \sa digitCount
     448*/
     449
     450void QLCDNumber::setNumDigits(int numDigits)
     451{
     452    setDigitCount(numDigits);
     453}
     454
     455/*!
     456    \since 4.6
     457    \property QLCDNumber::digitCount
    445458    \brief the current number of digits displayed
    446459
     
    454467*/
    455468
    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 */
     473void QLCDNumber::setDigitCount(int numDigits)
    457474{
    458475    Q_D(QLCDNumber);
     
    471488        d->digitStr.fill(QLatin1Char(' '), d->ndigits);
    472489        d->points.fill(0, d->ndigits);
    473         d->digitStr[d->ndigits - 1] = QLatin1Char('0');            // "0" is the default number
     490        d->digitStr[d->ndigits - 1] = QLatin1Char('0'); // "0" is the default number
    474491    } else {
    475492        bool doDisplay = d->ndigits == 0;
     
    510527
    511528/*!
     529  Returns the current number of digits.
     530 */
     531int QLCDNumber::digitCount() const
     532{
     533    Q_D(const QLCDNumber);
     534    return d->ndigits;
     535}
     536
     537/*!
    512538    \overload
    513539
     
    515541    otherwise returns false.
    516542
    517     \sa display(), numDigits(), smallDecimalPoint()
     543    \sa display(), digitCount(), smallDecimalPoint()
    518544*/
    519545
     
    531557    otherwise returns false.
    532558
    533     \sa display(), numDigits(), smallDecimalPoint()
     559    \sa display(), digitCount(), smallDecimalPoint()
    534560*/
    535561
     
    757783    QPainter p(this);
    758784    drawFrame(&p);
     785    p.setRenderHint(QPainter::Antialiasing);
     786    if (d->shadow)
     787        p.translate(0.5, 0.5);
     788
    759789    if (d->smallPoint)
    760790        d->drawString(d->digitStr, p, &d->points, false);
     
    10711101        }
    10721102        // End exact copy
    1073         p.setPen(fgColor);
     1103        p.setPen(Qt::NoPen);
    10741104        p.setBrush(fgColor);
    10751105        p.drawPolygon(a);
     
    12191249    \row \i \c Outline
    12201250         \i Produces raised segments filled with the background color
     1251    \row \i \c Filled
    12211252            (this is the default).
    1222     \row \i \c Filled
    12231253         \i Produces raised segments filled with the foreground color.
    12241254    \row \i \c Flat
     
    12531283QSize QLCDNumber::sizeHint() const
    12541284{
    1255     return QSize(10 + 9 * (numDigits() + (smallDecimalPoint() ? 0 : 1)), 23);
     1285    return QSize(10 + 9 * (digitCount() + (smallDecimalPoint() ? 0 : 1)), 23);
    12561286}
    12571287
     
    12721302/*!
    12731303    \fn int QLCDNumber::margin() const
    1274     Returns the with of the the margin around the contents of the widget.
     1304    Returns the width of the margin around the contents of the widget.
    12751305   
    12761306    Use QWidget::getContentsMargins() instead.
Note: See TracChangeset for help on using the changeset viewer.