[Breeze Style] Fix flickering during KPageTreeView animation

QTreeView animates expanding/collapsing of branches. It renders the widget into a temporary pixmap for speed
which is then animated. The pixmap's background, however, is unconditionally filled with the widget's palette's
base color which is different from the window background color onto which we paint when side panel frames are disabled.

This leads to flickering as the background is different during the animation. Depending on the colorscheme
this can be quite noticeable (e.g. Honeycomb).

Differential Revision: https://phabricator.kde.org/D7089
wilder-pre-rebase
Kai Uwe Broulik 9 years ago
parent e827fa0801
commit 09e09a9cd8
  1. 12
      kstyle/breezestyle.cpp

@ -56,6 +56,7 @@
#include <QToolBar>
#include <QToolBox>
#include <QToolButton>
#include <QTreeView>
#include <QWidgetAction>
namespace BreezePrivate
@ -398,6 +399,17 @@ namespace Breeze
scrollArea->viewport()->setForegroundRole( QPalette::WindowText );
}
// QTreeView animates expanding/collapsing branches. It paints them into a
// temp pixmap whose background is unconditionally filled with the palette's
// *base* color which is usually different from the window's color
// cf. QTreeViewPrivate::renderTreeToPixmapForAnimation()
if ( QTreeView *treeView = qobject_cast<QTreeView *>( scrollArea ) ) {
if (treeView->isAnimated()) {
QPalette pal( treeView->palette() );
pal.setColor( QPalette::Active, QPalette::Base, treeView->palette().color( treeView->backgroundRole() ) );
treeView->setPalette(pal);
}
}
}
}

Loading…
Cancel
Save