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/painting/qpen.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**
     
    5353/*!
    5454    \class QPen
    55     \ingroup multimedia
     55    \ingroup painting
    5656    \ingroup shared
    57     \mainclass
     57
    5858
    5959    \brief The QPen class defines how a QPainter should draw lines and outlines
     
    412412    converts the style of the pen to Qt::CustomDashLine.
    413413
     414    \note This function resets the dash offset to zero.
     415
    414416    \sa style(), {QPen#Pen Style}{Pen Style}
    415417*/
     
    421423    detach();
    422424    d->style = s;
    423     static_cast<QPenData *>(d)->dashPattern.clear();
     425    QPenData *dd = static_cast<QPenData *>(d);
     426    dd->dashPattern.clear();
     427    dd->dashOffset = 0;
    424428}
    425429
     
    463467    implicitly converts the style of the pen to Qt::CustomDashLine.
    464468
    465     The pattern must be specified as an even number of entries where
    466     the entries 1, 3, 5... are the dashes and 2, 4, 6... are the
     469    The pattern must be specified as an even number of positive entries
     470    where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the
    467471    spaces. For example:
    468472
     
    539543        return;
    540544    detach();
    541     static_cast<QPenData *>(d)->dashOffset = offset;
    542     d->style = Qt::CustomDashLine;
     545    QPenData *dd = static_cast<QPenData *>(d);
     546    dd->dashOffset = offset;
     547    if (d->style != Qt::CustomDashLine) {
     548        dd->dashPattern = dashPattern();
     549        d->style = Qt::CustomDashLine;
     550    }
    543551}
    544552
     
    828836    QPenData *dd = static_cast<QPenData *>(d);
    829837    QPenData *pdd = static_cast<QPenData *>(p.d);
    830     return (p.d == d) || (p.d->style == d->style
    831                           && p.d->capStyle == d->capStyle
    832                           && p.d->joinStyle == d->joinStyle
    833                           && p.d->width == d->width
    834                           && pdd->miterLimit == dd->miterLimit
    835                           && (d->style != Qt::CustomDashLine
    836                               || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) &&
    837                                   pdd->dashPattern == dd->dashPattern))
    838                           && p.d->brush == d->brush
    839                           && pdd->cosmetic == dd->cosmetic);
     838    return (p.d == d)
     839        || (p.d->style == d->style
     840            && p.d->capStyle == d->capStyle
     841            && p.d->joinStyle == d->joinStyle
     842            && p.d->width == d->width
     843            && pdd->miterLimit == dd->miterLimit
     844            && (d->style != Qt::CustomDashLine
     845                || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) &&
     846                    pdd->dashPattern == dd->dashPattern))
     847            && p.d->brush == d->brush
     848            && pdd->cosmetic == dd->cosmetic);
    840849}
    841850
     
    976985{
    977986#ifndef Q_BROKEN_DEBUG_STREAM
     987    const char *PEN_STYLES[] = {
     988        "NoPen",
     989        "SolidLine",
     990        "DashLine",
     991        "DotLine",
     992        "DashDotLine",
     993        "DashDotDotLine",
     994        "CustomDashLine"
     995    };
     996
    978997    dbg.nospace() << "QPen(" << p.width() << ',' << p.brush()
    979                   << ',' << int(p.style()) << ',' << int(p.capStyle())
     998                  << ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle())
    980999                  << ',' << int(p.joinStyle()) << ',' << p.dashPattern()
    981                   << "," << p.dashOffset()
     1000                  << ',' << p.dashOffset()
    9821001                  << ',' << p.miterLimit() << ')';
    9831002    return dbg.space();
Note: See TracChangeset for help on using the changeset viewer.