forked from qt-creator/qt-creator
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 f45f1a8cef, 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 <christian.stenger@qt.io>
This commit is contained in:
@@ -533,6 +533,8 @@ QToolButton *Perspective::addToolbarAction(QAction *action, const QIcon &toolbar
|
|||||||
op.action = action;
|
op.action = action;
|
||||||
op.icon = toolbarIcon;
|
op.icon = toolbarIcon;
|
||||||
op.toolbutton = new QToolButton;
|
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()
|
op.toolbutton->setDefaultAction(toolbarIcon.isNull()
|
||||||
? action : ProxyAction::proxyActionWithIcon(action, toolbarIcon));
|
? action : ProxyAction::proxyActionWithIcon(action, toolbarIcon));
|
||||||
m_toolbarOperations.append(op);
|
m_toolbarOperations.append(op);
|
||||||
@@ -544,6 +546,8 @@ void Perspective::addToolbarWidget(QWidget *widget)
|
|||||||
{
|
{
|
||||||
ToolbarOperation op;
|
ToolbarOperation op;
|
||||||
op.widget = widget;
|
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);
|
m_toolbarOperations.append(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user