diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 42690c190ef9679d5f70cd9f39ebbd590efbd6b6..c82abb050baef1a001c8a6f23a9c5d8182445376 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -231,9 +231,9 @@ void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, c if (StyleHelper::usePixmapCache()) { QString key; QColor keyColor = baseColor(lightColored); - key.sprintf("mh_horizontal %d %d %d %d %d", + key.sprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), - clipRect.height(), keyColor.rgb()); + clipRect.height(), keyColor.rgb(), spanRect.x()); QPixmap pixmap; if (!QPixmapCache::find(key, pixmap)) { diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index 334418816fbcb8d84caf8847f004125f671787c8..f6d3eba4dac30138be29cd21309989a640e3cb21 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -78,8 +78,6 @@ public: static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false); static void menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect); - - // Pixmap cache should only be enabled for X11 due to slow gradients static bool usePixmapCache() { return true; } static void drawIconWithShadow(const QPixmap &px, const QPoint &pos, QPainter *p, diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 2696fdb7ec1cac64c3908546662f6c467308d4e8..c9fb0a9cd929b58eeab0fe93902c6e8255611908 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -763,42 +763,22 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt case CE_ToolBar: { - QString key; - QColor keyColor = Utils::StyleHelper::baseColor(lightColored(widget)); - key.sprintf("mh_toolbar %d %d %d", option->rect.width(), option->rect.height(), keyColor.rgb());; - - QPixmap pixmap; - QPainter *p = painter; QRect rect = option->rect; bool horizontal = option->state & State_Horizontal; - if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - pixmap = QPixmap(option->rect.size()); - p = new QPainter(&pixmap); - rect = QRect(0, 0, option->rect.width(), option->rect.height()); - } - - if (!Utils::StyleHelper::usePixmapCache() || !QPixmapCache::find(key, pixmap)) { - // Map offset for global window gradient - QPoint offset = widget->window()->mapToGlobal(option->rect.topLeft()) - - widget->mapToGlobal(option->rect.topLeft()); - QRect gradientSpan; - if (widget) { - gradientSpan = QRect(offset, widget->window()->size()); - } - bool drawLightColored = lightColored(widget); - if (horizontal) - Utils::StyleHelper::horizontalGradient(p, gradientSpan, rect, drawLightColored); - else - Utils::StyleHelper::verticalGradient(p, gradientSpan, rect, drawLightColored); - } - - if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { - delete p; - QPixmapCache::insert(key, pixmap); - } - if (Utils::StyleHelper::usePixmapCache()) { - painter->drawPixmap(rect.topLeft(), pixmap); - } + rect = option->rect; + + // Map offset for global window gradient + QPoint offset = widget->window()->mapToGlobal(option->rect.topLeft()) - + widget->mapToGlobal(option->rect.topLeft()); + QRect gradientSpan; + if (widget) + gradientSpan = QRect(offset, widget->window()->size()); + + bool drawLightColored = lightColored(widget); + if (horizontal) + Utils::StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored); + else + Utils::StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored); painter->setPen(Utils::StyleHelper::borderColor());