Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to change the QDialog background fill color?



  • Curently it's picking up a weird light blue color that's not even in it's palette. How can this be changed within the designer?





  • I've changed it using the palette in QtDesigner however it's not being respected at runtime. The role I'm changing is 'Window', setting it to an RGB of (240,240,240), however at runtime it's showing as an RGB of (220,226,230). Any suggestions on why this is happening and how to fix it?

    I should add that I see in the generated file the proper brush:

    @ palette.setBrush(QPalette::Active, QPalette::Base, brush);
    QBrush brush1(QColor(240, 240, 240, 255));@

    Yet at runtime, it's being changed somehow.



  • u need to add setAutoFillBackground() to true.



  • I believe it's because I'm using QtitanRibbon, and its style is affecting all child windows of the MainWindow. Their style object seems to have a bug in its setIgnoreDialogs() method, as it's not respecting that.

    Update: There is no bug in Qtitan, I placed the call in the wrong file. I now have it resolved. Thanks.


Log in to reply