Wednesday, December 29, 2010

Adding an Icon to QPushButton.

It is very simple to add an icon to the QPushButton. To add an icon just place a QPushButton into the QMainWindow area and in the right bottom corner under the QPushButton properties select the icon and choose Select File to select an icon.

Do not worry about the size of your image file since it will be automatically re-sized to 16x16.
Note:
       The maximum size of icon that can be set in a QPushButton is 16x16. If you want to set a bigger size then you have to use QToolButton or do some inheritance with QPushButton and override the default icon size settings.

You can also add some css styles to enhance the look of your application.

No comments:

Post a Comment

Your Ad Here