PDA

View Full Version : QPushButton problem



sincnarf
20th August 2007, 17:34
Is there a way to determine if a QPushButton already has an icon, there seems to be no getIcon method.

Also how do you code that?

jpn
20th August 2007, 17:42
QPushButton is a QAbstractButton. QAbstractButton has a property icon (http://doc.trolltech.com/latest/qabstractbutton.html#icon-prop). And QIcon has a method to see whether it's "null" or not.

wysota
20th August 2007, 17:42
QAbstractButton::icon()

Edit: Great... lost another race to J-P...

sincnarf
20th August 2007, 21:26
In general, how do will I know what the parent class of widget is, I also would like to know what the parent class of QIcon is because there is not method for getting the file path of the image of the QIcon. Thanks to both of you as always, jpn and wysota

jpn
20th August 2007, 22:02
In general, how do will I know what the parent class of widget is
It's mentioned at the beginning of class docs. For example at the beginning of QPushButton docs it says "Inherits QAbstractButton". One can also see a "list of all members, including inherited members (http://doc.trolltech.com/latest/qpushbutton-members.html)" (link to this page is also at the beginning of class docs).


I also would like to know what the parent class of QIcon is because there is not method for getting the file path of the image of the QIcon.
Actually QIcon doesn't inherit anything. An image can be loaded from a file, but once it has been added to QIcon, it has nothing to do with the file. QIcon can contain several images anyway.


Great... lost another race to J-P...
You're watching too much Formula 1 :)