Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved stylesheet is not working properly

    General and Desktop
    2
    10
    4727
    Loading More Posts
    • 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.
    • S
      saber last edited by aha_1980

      qt 5.11.1 , linux.
      i applied this stylesheet in the central widget .

      QFrame [accessibleName="windowBar"]{
      background-color: #111111;
      color: #111111;
      border: 1px #111111;
      }
      
      QPushButton  [accessibleName="windowBar"]{
      border: 1px #2A2A2A;
      background-color: #111111; 
      }
      
      QPushButton:hover  [accessibleName="windowBar"]{
      background-color: #1268A4;
      }
      
      

      but is applied in designer fine ,but after build is shows this.

      0_1530413253262_as.png

      but is i use QWidget instead QFrame is works fine.

      what is the problem.

      mrjj 1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion @saber last edited by

        @saber
        Hi
        Works fine here for Frame in central widget
        alt text

        Is your frame actually child of centralwidget ? even at run time?

        S 1 Reply Last reply Reply Quote 0
        • S
          saber @mrjj last edited by

          @mrjj

          my frame is in the central widget ,always.

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @saber last edited by

            @saber
            Do you also have stylesheet on MainWindow ?

            S 1 Reply Last reply Reply Quote 0
            • S
              saber @mrjj last edited by

              @mrjj
              not in mainwindow .
              i put it in central widget.

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @saber last edited by mrjj

                @saber
                Aha, i see what you mean now.
                in Designer
                alt text
                But when run its gone.
                Not sure why that happens. seems odd.

                it is most likely related to this
                https://wiki.qt.io/Dynamic_Properties_and_Stylesheets

                S 1 Reply Last reply Reply Quote 0
                • S
                  saber @mrjj last edited by

                  @mrjj

                  so it happened on your side !!!??

                  mrjj 1 Reply Last reply Reply Quote 0
                  • mrjj
                    mrjj Lifetime Qt Champion @saber last edited by mrjj

                    @saber
                    Yep. Didn't get a green frame.
                    Its related to using properties in stylesheet as name works.

                    QFrame#frame {
                    background-color: #111111;
                    color: #111111;
                    border: 1px #111111;
                    }
                    

                    i thought maybe it was due to
                    accessibleName, but not shown using custom prop either.
                    So not sure why this case is not working.

                    update:
                    after clean build folder
                    this started working

                    QFrame[styleit=true]{
                    background-color: #111111;
                    color: #111111;
                    border: 1px #111111;
                    }
                    

                    styleit as a custom property added with the green +
                    (bool as type) and check for widgets.

                    alt text

                    I think the reason is the order in setupUI(). but did not test further.

                    S 1 Reply Last reply Reply Quote 3
                    • S
                      saber @mrjj last edited by

                      @mrjj
                      sorry for the late reply.

                      i did not understand the need and what is custom property is.

                      you know my app called corebox.
                      it has 14 apps combined .

                      i am trying to add two theme by stylsheet .but i am facing many defecults .
                      it is just a one.

                      so i am giving you invitation to join this project to solve this major problems that we are facing and not able to fix.

                      thanks.

                      mrjj 1 Reply Last reply Reply Quote 0
                      • mrjj
                        mrjj Lifetime Qt Champion @saber last edited by

                        @saber
                        A custom property is just one you make yourself.
                        Its the green + over the properties.

                        1 Reply Last reply Reply Quote 5
                        • First post
                          Last post