Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezestyle.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | #include <QRadioButton> | 51 | #include <QRadioButton> | ||
52 | #include <QScrollBar> | 52 | #include <QScrollBar> | ||
53 | #include <QItemDelegate> | 53 | #include <QItemDelegate> | ||
54 | #include <QSplitterHandle> | 54 | #include <QSplitterHandle> | ||
55 | #include <QTextEdit> | 55 | #include <QTextEdit> | ||
56 | #include <QToolBar> | 56 | #include <QToolBar> | ||
57 | #include <QToolBox> | 57 | #include <QToolBox> | ||
58 | #include <QToolButton> | 58 | #include <QToolButton> | ||
59 | #include <QTreeView> | ||||
59 | #include <QWidgetAction> | 60 | #include <QWidgetAction> | ||
60 | 61 | | |||
61 | namespace BreezePrivate | 62 | namespace BreezePrivate | ||
62 | { | 63 | { | ||
63 | 64 | | |||
64 | // needed to keep track of tabbars when being dragged | 65 | // needed to keep track of tabbars when being dragged | ||
65 | class TabBarData: public QObject | 66 | class TabBarData: public QObject | ||
66 | { | 67 | { | ||
▲ Show 20 Lines • Show All 326 Lines • ▼ Show 20 Line(s) | 392 | { | |||
393 | scrollArea->setForegroundRole( QPalette::WindowText ); | 394 | scrollArea->setForegroundRole( QPalette::WindowText ); | ||
394 | 395 | | |||
395 | if( scrollArea->viewport() ) | 396 | if( scrollArea->viewport() ) | ||
396 | { | 397 | { | ||
397 | scrollArea->viewport()->setBackgroundRole( QPalette::Window ); | 398 | scrollArea->viewport()->setBackgroundRole( QPalette::Window ); | ||
398 | scrollArea->viewport()->setForegroundRole( QPalette::WindowText ); | 399 | scrollArea->viewport()->setForegroundRole( QPalette::WindowText ); | ||
399 | } | 400 | } | ||
400 | 401 | | |||
402 | // QTreeView animates expanding/collapsing branches. It paints them into a | ||||
403 | // temp pixmap whose background is unconditionally filled with the palette's | ||||
404 | // *base* color which is usually different from the window's color | ||||
405 | // cf. QTreeViewPrivate::renderTreeToPixmapForAnimation() | ||||
406 | if ( QTreeView *treeView = qobject_cast<QTreeView *>( scrollArea ) ) { | ||||
407 | if (treeView->isAnimated()) { | ||||
408 | QPalette pal( treeView->palette() ); | ||||
hpereiradacosta: Setting palettes manually is always somewhat dangerous, (can break child widgets for instance… | |||||
409 | pal.setColor( QPalette::Active, QPalette::Base, treeView->palette().color( treeView->backgroundRole() ) ); | ||||
410 | treeView->setPalette(pal); | ||||
411 | } | ||||
412 | } | ||||
401 | } | 413 | } | ||
402 | 414 | | |||
403 | } | 415 | } | ||
404 | 416 | | |||
405 | // disable autofill background for flat (== NoFrame) scrollareas, with QPalette::Window as a background | 417 | // disable autofill background for flat (== NoFrame) scrollareas, with QPalette::Window as a background | ||
406 | // this fixes flat scrollareas placed in a tinted widget, such as groupboxes, tabwidgets or framed dock-widgets | 418 | // this fixes flat scrollareas placed in a tinted widget, such as groupboxes, tabwidgets or framed dock-widgets | ||
407 | if( !(scrollArea->frameShape() == QFrame::NoFrame || scrollArea->backgroundRole() == QPalette::Window ) ) | 419 | if( !(scrollArea->frameShape() == QFrame::NoFrame || scrollArea->backgroundRole() == QPalette::Window ) ) | ||
408 | { return; } | 420 | { return; } | ||
▲ Show 20 Lines • Show All 6658 Lines • Show Last 20 Lines |
Setting palettes manually is always somewhat dangerous, (can break child widgets for instance, which would inherit this palette).
Can we at least hide this code behind a check for QTreeView, and even "isAnimated()" ?