[SOLVED] Customizing QPushButton - using Bootstrap css



  • I would like to customize a QPushButton to look like this :
    https://www.dropbox.com/s/grhhaty92pnl41a/ButtonBootstrap.png

    This button is made with bootstrap and is used on my website.
    Here is the .css code (from bootstrap .css)
    @.btn-default {
    color: #333;
    background-color: #fff;
    border-color: #ccc;
    }@

    I want to emulate the same kind of button for my Qt app, I used the same .css, but the button shows no color and no border at all.
    I know Qt stylesheet syntax is different, is there a documentation explaining the differences. It would be perfect if it could be like css3 so we could reuse web stuff directly inside Qt.. Right now it's hard to code nice looking widgets, Or maybe i'm missing an open-source library like bootstrap that is made for Qt?

    Thanks!



  • I did it by hand with Qt and it's not too bad..
    Using gimp and getting the color palette the hard way ;)

    @QPushButton.boutonVert {
    color : white;
    background-color: #5cb85c;
    border: 2px solid #4cae4c;
    border-radius: 3px;
    padding: 5px;
    min-width: 80px;
    }

    QPushButton.boutonVert:hover {
    background-color: #47a447;
    border: 2px solid #398439;
    }

    QPushButton.boutonVert:pressed {
    border: 3px solid #398439;
    }
    /*
    QPushButton.boutonVert:disabled {
    color : red;
    background-color: #5cb85c;
    border: 2px solid #4cae4c;
    }
    */@


Log in to reply
 

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