Unable to overwrite widget->setStyleSheet wtih QApplication->setStyleSheet



  • I do the following in my application, where button_toggleSearchAreaResults is a QToolButton:

    button_toggleSearchAreaResults->setStyleSheet( QStringLiteral( "QToolButton::on{border-image:url(:/icons/1downarrow_grey.png);} "
    "QToolButton{border-image:url(:/icons/1rightarrow_grey.png);}" ) );
    

    This gets me my images OK. Then, I'd like to overwrite them from QApplication->setStyleSheet, so I call it with:

    QToolButton#button_toggleSearchAreaResults::on
    {
       background-color: none;
       border-image: none;
       border-image: url(rightlocationhere/qdarkstyle/rc/down_arrow_disabled.png);
    }
    
    QToolButton#button_toggleSearchAreaResults:hover
    {
       border-image: url(rightlocationhere/qdarkstyle/rc/right_arrow.png);
    }
    QToolButton#button_toggleSearchAreaResults::on:hover
    {
       border-image: url(rightlocationhere/qdarkstyle/rc/down_arrow.png);
    }
    

    If I don't have my widget->setStyleSheet call, QApplication->setStyleSheet works fine. If I do, it's not able to overwrite the border-image property - how come?



  • Widget style sheet has precedence over qapplication style sheet. Hence u r seeing this issue


Log in to reply
 

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