Styling QPushButton border doesn't work properly on latest Qt with MacOS??



  • my code

    button->setStyleSheet(QString("QPushButton {color: #444444; background: #e6e6e6; border: 2px solid #cccccc;} QPushButton:hover {border-bottom: 2px black solid; color: #333333;background: #F7F7F7;} QPushButton:pressed {background: #e6e6e6;}"));
    

    The above styles ALL the borders. If I use the style below

    border: 0px 0px 2px 0px solid #000000
    

    it styles no border at all! I am using Qt Creator 4.8.1, Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit) on a MacOS Mojave 10.14


  • Moderators

    That's not valid css. border does not take 4 separate width parameters, only one shared across all sides. If you want to set borders different for each side you need to use border-width:

    border: solid #000000; border-width: 0px 0px 2px 0px;
    

Log in to reply
 

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