From 1d68e08359520c70065d583b0fc47fa339f3b61b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 10 Aug 2018 14:31:55 +0200 Subject: [PATCH] Fix color of labels and combo boxes in debugger toolbar ManhattanStyle adapts the palette of widgets in its polish(...) method. But creating widgets directly schedules a polish event, and after a widget was polished it will never be polished again (except if the style changes). Before f45f1a8cef95e454fca75d288cea5c06a2ae138a, toolbar widgets were directly added to the widget hierarchy of the toolbar, but now that is no longer the case. That means that the widgets are polished before they are added to the toolbar hierarchy, so ManhattanStyle does not change their palette. To fix this we explicitly make tool bar widgets "panelwidget"s when they are added to a perspective. Task-number: QTCREATORBUG-20916 Change-Id: I659798c7c314a481d1ec467b1877f2e6ddd6da70 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggermainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index cd1acf417b9..1e13979427c 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -533,6 +533,8 @@ QToolButton *Perspective::addToolbarAction(QAction *action, const QIcon &toolbar op.action = action; op.icon = toolbarIcon; op.toolbutton = new QToolButton; + // QStyle::polish is called before it is added to the toolbar, explicitly make it a panel widget + op.toolbutton->setProperty("panelwidget", true); op.toolbutton->setDefaultAction(toolbarIcon.isNull() ? action : ProxyAction::proxyActionWithIcon(action, toolbarIcon)); m_toolbarOperations.append(op); @@ -544,6 +546,8 @@ void Perspective::addToolbarWidget(QWidget *widget) { ToolbarOperation op; op.widget = widget; + // QStyle::polish is called before it is added to the toolbar, explicitly make it a panel widget + op.widget->setProperty("panelwidget", true); m_toolbarOperations.append(op); }