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. GUI background color
Forum Update on Monday, May 27th 2025

GUI background color

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 524 Views
  • 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.
  • R Offline
    R Offline
    russjohn834
    wrote on last edited by
    #1

    Hi all,
    I've basic question.
    I have got an image which is attached to a label with a white background colour. But the GUI default background colour is kind of grey, as you see in the picture.

    How do I change it to match the picture background?

    c73c36c1-a1a2-4dc6-b781-188434920278-image.png

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      One option is stylesheet

      MainWindow->setStyleSheet(QString::fromUtf8("#centralWidget {\n"
      "background-color: rgb(255, 255, 255);\n"
      "}"));

      The #centralWidget is the Widget object name. make sure to change to match yours.

      1 Reply Last reply
      3
      • R Offline
        R Offline
        russjohn834
        wrote on last edited by
        #3

        @mrjj Thanks for your suggestion :)

        mrjjM 1 Reply Last reply
        0
        • R russjohn834

          @mrjj Thanks for your suggestion :)

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @russjohn834
          Hi
          There is also
          https://wiki.qt.io/How_to_Change_the_Background_Color_of_QWidget

          1 Reply Last reply
          2

          • Login

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