Can we set id for image or pixmap?
-
Like button can we set id for pixmap or image?
-
If we are talking about objectName here then no, as QPixmap and QImage do not inherit from QObject.
-
What do you mean, when you speaking "id".
Can you explain more, please? -
id is an integer identifier of any widget or in this case i am talking about id of image.
-
No, but you can't do that with QPushButton either. Can you elaborate on this?
-
What for do you want id?
Two ways
- Pointer to object already uniquely identified object.
- You can create QHash<int, QImage> for correlation some id with your objects.
-
Are you using a property as your id?
-
with QPushbutton we can't use but with Qbuttongroup we can add to it. I have an image in Qpixmap
i want to access that image through a unique id. -
This is a feature unique to QButtonGroup.
See Vass' post for a solution. Depending on how you manage the lifetime of your objects you might use QHash<int, QImage*> instead.
8/9