Sunday, June 13, 2010

How to add stylesheet for button in Qt





Here i am showing, how to set the button background color from stylesheet.

CustomButton *pushButton = new CustomButton();
pushButton->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 255, 0);"));


How to set background image for button using stylesheet.

CustomButton *pushButton = new CustomButton();
pushButton_2->setStyleSheet(QString::fromUtf8("background-image: url(:/new/prefix1/icon/Smiley.bmp);"));


if you are using Qt GUI for designing, follow up these steps.












No comments:

Post a Comment