Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Where to find the qtstylesheet grammar rules?
Qt 6.12 LTS is out! See what's new in the release blog

Where to find the qtstylesheet grammar rules?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.4k 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1

    Now I just figured out what does the classes mean from the official api.
    But somewhere the code likes below:
    8750ed29-ec5b-4b0b-849b-9d9adc93bd66-image.png
    just look like the css style.But I dont know how to bind this to the qt c++ code.
    So if could give me the links to the grammar rules of the qtstylesheet would be great.

    JonBJ 1 Reply Last reply
    0
    • nicker playerN nicker player

      Now I just figured out what does the classes mean from the official api.
      But somewhere the code likes below:
      8750ed29-ec5b-4b0b-849b-9d9adc93bd66-image.png
      just look like the css style.But I dont know how to bind this to the qt c++ code.
      So if could give me the links to the grammar rules of the qtstylesheet would be great.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @nicker-player said in Where to find the qtstylesheet grammar rules?:

      But I dont know how to bind this to the qt c++ code.

      Don't know what this means.

      So if could give me the links to the grammar rules of the qtstylesheet

      https://doc.qt.io/qt-6/stylesheet-reference.html
      https://doc.qt.io/qt-6/stylesheet-examples.html
      In particular: https://doc.qt.io/qt-6/stylesheet-syntax.html

      Your particular example is an "advanced" one:

      .IconfontBtn[white_bk="true"]:disabled
      

      This *selector" applies to:

      1. A widget of a C++ class named IconfontBtn....
      2. ...which has a dynamic property set whose name is white_bk and which has a value of true...
      3. ...and it is currently set to disabled.
      nicker playerN 1 Reply Last reply
      2
      • JonBJ JonB

        @nicker-player said in Where to find the qtstylesheet grammar rules?:

        But I dont know how to bind this to the qt c++ code.

        Don't know what this means.

        So if could give me the links to the grammar rules of the qtstylesheet

        https://doc.qt.io/qt-6/stylesheet-reference.html
        https://doc.qt.io/qt-6/stylesheet-examples.html
        In particular: https://doc.qt.io/qt-6/stylesheet-syntax.html

        Your particular example is an "advanced" one:

        .IconfontBtn[white_bk="true"]:disabled
        

        This *selector" applies to:

        1. A widget of a C++ class named IconfontBtn....
        2. ...which has a dynamic property set whose name is white_bk and which has a value of true...
        3. ...and it is currently set to disabled.
        nicker playerN Offline
        nicker playerN Offline
        nicker player
        wrote on last edited by
        #3

        @JonB
        Thanks .I just need the links.
        And by the way,in the project that some ui objects were created by the codes.There were so many lines of the project,I dont konw how to find the ui object codes from the project.Anything good idea that find the codes quickly?

        JonBJ C 2 Replies Last reply
        0
        • nicker playerN nicker player

          @JonB
          Thanks .I just need the links.
          And by the way,in the project that some ui objects were created by the codes.There were so many lines of the project,I dont konw how to find the ui object codes from the project.Anything good idea that find the codes quickly?

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @nicker-player
          Use search? Search for IconfontBtn? Search for white_bk?

          1 Reply Last reply
          0
          • nicker playerN nicker player

            @JonB
            Thanks .I just need the links.
            And by the way,in the project that some ui objects were created by the codes.There were so many lines of the project,I dont konw how to find the ui object codes from the project.Anything good idea that find the codes quickly?

            C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            @nicker-player said in Where to find the qtstylesheet grammar rules?:

            Thanks .I just need the links.
            And by the way,in the project that some ui objects were created by the codes.

            I assume you mean that some code was generated to match a UI you built in Qt Creator (or Designer). The names in this code will match the names you see in Designer. So if you have a form named MyForm containing a widget with name pathLineEdit in the UI design then the generated code will contain a variable pathLineEdit that you can (usually) access your own code through a the ui pointer like this:

            ui->pathLineEdit->setText("blah");
            

            The actual generated code will be in the build directory in a file called ui_MyWidget.h that you will see as:

            #include "ui_MyWidget.h"
            

            in your MyForm class sources.

            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
            • Unsolved