Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change the QDialog background fill color?
Forum Updated to NodeBB v4.3 + New Features

How to change the QDialog background fill color?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 9.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Little Red Wolf
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      You can use "QPalette":http://qt-project.org/doc/qt-4.8/qpalette.html

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Little Red Wolf
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on last edited by
          #4

          u need to add setAutoFillBackground() to true.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Little Red Wolf
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved