天天看点

qss使用及优先级关系优先级

优先级

  1. 更加具体的语句要优先级更高,有伪状态的优先级高,有指定objectname的优先级最高。

    QPushButton{color:red;}

    <

    QPushButton:hover{color: green}

    <

    QPushButton#A{color: white}

  2. 类之间的继承关系不会影响优先级的判断,谁位于之后,那它的优先级就更高。

    QPushButton{color: white}

    QAbstractButton{color: black}

继续阅读