CSS: dynamic properties and (pseudo) states



  • Hello,
    I am looking for a line edit with hover effect and different border sizes for enabeld/ not enabeld.
    And the border should change with respect to some dynamic property ( if widget is enabled).
    I tried:

    QLineEdit!enabled {border: 0px}
    QLineEdit:hover   {border: 1px solid blue}
    QLineEdit[contrast=\"0\"]:enabled {border: 1px solid white}
    QLineEdit[contrast=\"1\"]:enabled {border: 1px solid gray}
    QLineEdit[contrast=\"2\"]:enabled {border: 1px solid black}
    

    and

    QLineEdit[contrast=\"0\"]!enabled {border: 0px}
    QLineEdit[contrast=\"1\"]!enabled {border: 0px}
    QLineEdit[contrast=\"2\"]!enabled {border: 0px}
    QLineEdit[contrast=\"0\"]:hover   {border: 1px solid blue}
    QLineEdit[contrast=\"1\"]:hover   {border: 1px solid blue}
    QLineEdit[contrast=\"2\"]:hover   {border: 1px solid blue}
    QLineEdit[contrast=\"0\"]:enabled {border: 1px solid white}
    QLineEdit[contrast=\"1\"]:enabled {border: 1px solid gray}
    QLineEdit[contrast=\"2\"]:enabled {border: 1px solid black}
    

    I use unpolish/ polish on changing property.
    So at least I get dynamic color with second solution but no hover.
    First solution does not work too.

    How to combine dynamic properties und states?

    Thank you!
    Thomas