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. invalid style sheet error for QButton
Qt 6.11 is out! See what's new in the release blog

invalid style sheet error for QButton

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 2.6k 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.
  • A Offline
    A Offline
    agmar
    wrote on last edited by
    #1

    Hi,
    i wanted to change the colour for a button in the ui i was workin on , but i get this error and i tried the same with code, it didnt seem to work, is there anything that could fix this ? 2c988314-ed13-4879-985c-6458e58d5ec3-image.png

    jsulmJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @agmar Shouldn't you specify what color you want to change? Just like you can see here: https://doc.qt.io/qt-6/stylesheet-reference.html

      A Offline
      A Offline
      agmar
      wrote on last edited by
      #3

      @jsulm

      i thought i selected the color i want to change by selecting one of these
      b1c8fe9e-de6f-4f77-bdf8-626e7fc40c34-image.png

      if i click on e of them you get the situation that i showed in the first photo that i sent. the documentation isnt very...useful

      jsulmJ 1 Reply Last reply
      0
      • A agmar

        Hi,
        i wanted to change the colour for a button in the ui i was workin on , but i get this error and i tried the same with code, it didnt seem to work, is there anything that could fix this ? 2c988314-ed13-4879-985c-6458e58d5ec3-image.png

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @agmar Shouldn't you specify what color you want to change? Just like you can see here: https://doc.qt.io/qt-6/stylesheet-reference.html

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        A 2 Replies Last reply
        0
        • jsulmJ jsulm

          @agmar Shouldn't you specify what color you want to change? Just like you can see here: https://doc.qt.io/qt-6/stylesheet-reference.html

          A Offline
          A Offline
          agmar
          wrote on last edited by
          #3

          @jsulm

          i thought i selected the color i want to change by selecting one of these
          b1c8fe9e-de6f-4f77-bdf8-626e7fc40c34-image.png

          if i click on e of them you get the situation that i showed in the first photo that i sent. the documentation isnt very...useful

          jsulmJ 1 Reply Last reply
          0
          • A agmar

            @jsulm

            i thought i selected the color i want to change by selecting one of these
            b1c8fe9e-de6f-4f77-bdf8-626e7fc40c34-image.png

            if i click on e of them you get the situation that i showed in the first photo that i sent. the documentation isnt very...useful

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @agmar You selected a color, but color for what?!
            Please read documentation, there is even an example:

            QPushButton { background-color: red; border: none; }
            

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply
            1
            • jsulmJ jsulm

              @agmar Shouldn't you specify what color you want to change? Just like you can see here: https://doc.qt.io/qt-6/stylesheet-reference.html

              A Offline
              A Offline
              agmar
              wrote on last edited by
              #5

              @jsulm also, i assumed that we can change the properties thought the mainwindow.ui section in the properties found here?
              3b6d40d8-757a-4650-919c-39f50b11bbab-image.png

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @agmar You selected a color, but color for what?!
                Please read documentation, there is even an example:

                QPushButton { background-color: red; border: none; }
                
                A Offline
                A Offline
                agmar
                wrote on last edited by
                #6

                @jsulm i wish it worked tho 38db371e-16e2-4918-9374-4895bda21515-image.png

                jsulmJ 1 Reply Last reply
                0
                • A agmar has marked this topic as solved on
                • A agmar

                  @jsulm i wish it worked tho 38db371e-16e2-4918-9374-4895bda21515-image.png

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #7

                  @agmar C++ basics. What you wrote is not valid C++. A style-sheet is a string...
                  And you also need to use https://doc.qt.io/qt-6/qwidget.html#styleSheet-prop if you want to set style-sheet in code.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1

                  • Login

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