src/gui/styles/qplastiquestyle.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/src/gui/styles/qplastiquestyle.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/gui/styles/qplastiquestyle.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -488,7 +488,9 @@
         // Modify the texture - ridiculously expensive.
         QPixmap texture = brush->texture();
         QPixmap pixmap;
-        QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
+        QString name = QLatin1Literal("qbrushtexture-alpha")
+                       % HexString<qreal>(alpha)
+                       % HexString<qint64>(texture.cacheKey());
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
             QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
@@ -549,7 +551,10 @@
         // Modify the texture - ridiculously expensive.
         QPixmap texture = brush.texture();
         QPixmap pixmap;
-        QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
+        QString name = QLatin1Literal("qbrushtexture-light")
+                       % HexString<int>(light)
+                       % HexString<qint64>(texture.cacheKey());
+
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
             QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
@@ -608,7 +613,10 @@
         // Modify the texture - ridiculously expensive.
         QPixmap texture = brush.texture();
         QPixmap pixmap;
-        QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
+        QString name = QLatin1Literal("qbrushtexture-dark")
+                       % HexString<int>(dark)
+                       % HexString<qint64>(texture.cacheKey());
+
         if (!QPixmapCache::find(name, pixmap)) {
             QImage image = texture.toImage();
             QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
@@ -732,8 +740,12 @@
 static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
                                        const QColor &gradientStop)
 {
-    QString gradientName;
-    gradientName.sprintf("%dx%d-%x-%x", rect.width(), rect.height(), gradientStart.rgba(), gradientStop.rgba());
+    QString gradientName = QLatin1Literal("qplastique-g")
+                   % HexString<int>(rect.width())
+                   % HexString<int>(rect.height())
+                   % HexString<QRgb>(gradientStart.rgba())
+                   % HexString<QRgb>(gradientStop.rgba());
+
     QPixmap cache;
     QPainter *p = painter;
     QRect r = rect;
@@ -1092,14 +1104,6 @@
     Q_ASSERT(option);
 
     QColor borderColor = option->palette.background().color().darker(178);
-    QColor gradientStartColor = option->palette.button().color().lighter(104);
-    QColor gradientStopColor = option->palette.button().color().darker(105);
-    QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);
-    QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
-    QColor highlightedBaseGradientStartColor = option->palette.base().color();
-    QColor highlightedBaseGradientStopColor = mergedColors(option->palette.base().color().darker(105), option->palette.highlight().color(), 70);
-    QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35);
-    QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58);
     QColor alphaCornerColor;
     if (widget) {
         // ### backgroundrole/foregroundrole should be part of the style option
@@ -1107,13 +1111,7 @@
     } else {
         alphaCornerColor = mergedColors(option->palette.background().color(), borderColor);
     }
-    QColor alphaInnerColor = mergedColors(highlightedLightInnerBorderColor, gradientStartColor);
-    QColor alphaInnerColorNoHover = mergedColors(borderColor, gradientStartColor);
     QColor alphaTextColor = mergedColors(option->palette.background().color(), option->palette.text().color());
-    QColor alphaLightTextColor = mergedColors(option->palette.background().color().lighter(250), option->palette.text().color().lighter(250));
-    QColor lightShadow = option->palette.button().color().lighter(105);
-    QColor shadowGradientStartColor = option->palette.button().color().darker(115);
-    QColor shadow = shadowGradientStartColor;
 
     switch (element) {
     case PE_IndicatorButtonDropDown:
@@ -2057,7 +2055,6 @@
             bool reverse = (tab->direction == Qt::RightToLeft);
 
             int lowerTop = selected ? 0 : 3; // to make the selected tab bigger than the rest
-            QRect adjustedRect;
             bool atEnd = (tab->position == QStyleOptionTab::End) || onlyTab;
             bool atBeginning = ((tab->position == QStyleOptionTab::Beginning) || onlyTab)
                                && !leftCornerWidget;