Changeset 846 for trunk/src/gui/painting/qbrush.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/painting/qbrush.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 49 49 #include "qdebug.h" 50 50 #include <QtCore/qcoreapplication.h> 51 #include "private/qstylehelper_p.h" 51 52 52 53 QT_BEGIN_NAMESPACE … … 97 98 QPixmap qt_pixmapForBrush(int brushStyle, bool invert) 98 99 { 100 99 101 QPixmap pm; 100 QString key = QLatin1String("$qt-brush$") + QString::number(brushStyle) 101 + QString::number((int)invert); 102 QString key = QLatin1Literal("$qt-brush$") 103 % HexString<uint>(brushStyle) 104 % QLatin1Char(invert ? '1' : '0'); 102 105 if (!QPixmapCache::find(key, pm)) { 103 106 pm = QBitmap::fromData(QSize(8, 8), qt_patternForBrush(brushStyle, invert), … … 330 333 \endtable 331 334 332 For more information about painting in general, see \l{ThePaint333 System} documentation.335 For more information about painting in general, see the \l{Paint 336 System}. 334 337 335 338 \sa Qt::BrushStyle, QPainter, QColor … … 912 915 913 916 Two brushes are different if they have different styles, colors or 914 pixmaps.917 transforms or different pixmaps or gradients depending on the style. 915 918 916 919 \sa operator==() … … 924 927 925 928 Two brushes are equal if they have equal styles, colors and 926 pixmaps.929 transforms and equal pixmaps or gradients depending on the style. 927 930 928 931 \sa operator!=() … … 933 936 if (b.d == d) 934 937 return true; 935 if (b.d->style == d->style && b.d->color == d->color) { 936 switch (d->style) { 937 case Qt::TexturePattern: { 938 QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap(); 939 QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap(); 938 if (b.d->style != d->style || b.d->color != d->color || b.d->transform != d->transform) 939 return false; 940 switch (d->style) { 941 case Qt::TexturePattern: 942 { 943 const QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap(); 944 const QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap(); 940 945 return ((us.isNull() && them.isNull()) || us.cacheKey() == them.cacheKey()); 941 946 } 942 case Qt::LinearGradientPattern: 943 case Qt::RadialGradientPattern: 944 case Qt::ConicalGradientPattern: 945 { 946 QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data()); 947 QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data()); 948 return d1->gradient == d2->gradient; 949 } 950 default: 951 return true; 947 case Qt::LinearGradientPattern: 948 case Qt::RadialGradientPattern: 949 case Qt::ConicalGradientPattern: 950 { 951 const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data()); 952 const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data()); 953 return d1->gradient == d2->gradient; 952 954 } 953 } 954 return false; 955 default: 956 return true; 957 } 955 958 } 956 959 … … 1014 1017 reference to the \a stream. 1015 1018 1016 \sa { Format of the QDataStream Operators}1019 \sa {Serializing Qt Data Types} 1017 1020 */ 1018 1021 … … 1082 1085 reference to the \a stream. 1083 1086 1084 \sa { Format of the QDataStream Operators}1087 \sa {Serializing Qt Data Types} 1085 1088 */ 1086 1089 … … 1216 1219 \endtable 1217 1220 1218 The colors in a gradient is defined using stop points of the 1219 QGradientStop type, i.e. a position and a color. Use the 1220 setColorAt() function to define a single stop 1221 point. Alternatively, use the setStops() function to define 1222 several stop points in one go. Note that the latter function \e 1223 replaces the current set of stop points. 1221 The colors in a gradient are defined using stop points of the 1222 QGradientStop type; i.e., a position and a color. Use the setColorAt() 1223 function to define a single stop point. Alternatively, use the 1224 setStops() function to define several stop points in one go. Note that 1225 the latter function \e replaces the current set of stop points. 1224 1226 1225 1227 It is the gradient's complete set of stop points (accessible 1226 1228 through the stops() function) that describes how the gradient area 1227 should be filled. If no stop points have been specified, a 1228 gradientof black at 0 to white at 1 is used.1229 should be filled. If no stop points have been specified, a gradient 1230 of black at 0 to white at 1 is used. 1229 1231 1230 1232 A diagonal linear gradient from black at (100, 100) to white at
Note:
See TracChangeset
for help on using the changeset viewer.