[solved] If it is possible to set position:relative in setStyleSheet to QPushButton?



  • Hi,
    I was wondering if there is possibility to set position:relative to QPushbutton using stylesheet, because I have tried this and nothing happens.

    @
    QString style = QString("QPushButton{") +
    "background-color: #3d94f6;" +
    "border: 1px solide #29569e;" +
    "border-radius: 5px;" +
    "background: qlineargradient(x1: 0, y1:0, x2: 0, y2: 1, " +
    "stop: 0 #3d94f6, stop: 1 #29569e);" +
    "font-family: arial;" +
    "font size: 12px;" +
    "}"+
    "QPushButton:hover{" +
    "background-color: #3d94f6;" +
    "border: 1px solide #29569e;" +
    "border-radius: 5px;" +
    "background: qlineargradient(x1: 0, y1:0, x2: 0, y2: 1, " +
    "stop: 0 #29569e, stop: 1 #3d94f6);" +
    "font-family: arial;" +
    "font size: 12px;" +
    "}"+
    "QPushButton:checked{" +
    "position:relative;" +
    "top: 3px;"+
    "background: qlineargradient(x1: 0, y1:0, x2: 0, y2: 1, " +
    "stop: 0 #29569e, stop: 1 #3d94f6);" +
    "}"
    @


  • Lifetime Qt Champion

    Hi,

    AFAIK and unless I'm mistaken, the position keyword can only be used for sub controls



  • It's a pity. So maybe I can change font size?

    EDIT: Ok, I get the same clicking effect by setting shadow to button and resizing font.


Log in to reply
 

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