Qt Designer Window Color Problem
-
Hi,
I've been using Qt designer to develop a Windows C++ application and and having a problem with changing the Window color in the palette editor. When I change the Window color in the editor it displays properly (ie, just the "background" of the window). However, when I compile and run the program both the toolbar and status bar change to the same color as the Window color. Is this a bug? Is there a workaround? -
Thanks shint. I tried checking/unchecking the autofillbackground checkbox but it doesn't fix the problem. It does however make the designer form look like what I'm seeing after I compile and run the program...so at least it matches. The problem is that whether autofillbackground is checked or not the background gets autofilled anyway. Do you get the same results? I have 2 different applications that I'm working with and it does the same on both. I'm running Windows 7 64-bit.
-
This is nothing from QtCreator, it has to do with parent / child relationship.
@
void QWidget::setPalette(const QPalette &palette)
{
...
d->setPalette_helper(resolvedPalette);
...
}void QWidgetPrivate::setPalette_helper(const QPalette &palette)
{
...
propagatePaletteChange();
...
}/*!
\internalPropagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows).
*/
void QWidgetPrivate::propagatePaletteChange()
{
...
for (int i = 0; i < children.size(); ++i) {
QWidget w = qobject_cast<QWidget>(children.at(i));
if (w && !w->testAttribute(Qt::WA_StyleSheet)
&& (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)))
{
QWidgetPrivate *wd = w->d_func();
wd->inheritedPaletteResolveMask = mask;
wd->resolvePalette();
}
}
...
}
@Which popagates palette c hanges to all sub widgets :-)
you can also look at the "docs,":http://doc.qt.nokia.com/latest/qwidget.html#palette-prop were it is stated:
bq. QWidget propagates explicit palette roles from parent to child. If you assign a brush or color to a specific role on a palette and assign that palette to a widget, that role will propagate to all the widget's children, overriding any system defaults for that role. Note that palettes by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.