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 10 Jul 2020, 11:10 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 10 Jul 2020, 12:35 last edited by mrjj 7 Oct 2020, 12:36
      #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 10 Jul 2020, 13:18 last edited by
        #3

        @mrjj Thanks for your suggestion :)

        M 1 Reply Last reply 10 Jul 2020, 13:19
        0
        • R russjohn834
          10 Jul 2020, 13:18

          @mrjj Thanks for your suggestion :)

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 10 Jul 2020, 13:19 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

          1/4

          10 Jul 2020, 11:10

          • Login

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