stylesheet is not working properly



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


  • Qt Champions 2017

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

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



  • @mrjj

    my frame is in the central widget ,always.


  • Qt Champions 2017

    @saber
    Do you also have stylesheet on MainWindow ?



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


  • Qt Champions 2017

    @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



  • @mrjj

    so it happened on your side !!!??


  • Qt Champions 2017

    @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.



  • @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.


  • Qt Champions 2017

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.