What do you mean a GUI class that inherits QPixmap? In Designer? Could you explain?
What do you mean a GUI class that inherits QPixmap? In Designer? Could you explain?
OK, I will try to explain better. In Visual Studio I select Project -> Add Qt GUI Class. There is line edit field named "Base Class". If I type in QPixmap as base class, then code that is produced by Designer is invalid. I gett errors such as objectName is not a member of QPixmap and similar. If base class is QDialog or QWidget, there are obviously no errors because these two classes inherit QObject. Am I missing something here?
If I select Project -> Add Qt Class instead of Project -> Add GUI Qt Class, then constructor is invalid. I get this error:
It seems to me that Designer doesn't support adding QPixmap widget. If I am missing something please help me see how dumb I amerror C2664: 'QPixmap::QPixmap(const QSize &)' : cannot convert parameter 1 from 'QObject*' to 'const QSize &'
1> Reason: cannot convert from 'QObject *' to 'const QSize'
1> No constructor could take the source type, or constructor overload resolution was ambiguous![]()
Last edited by jpn; 4th March 2008 at 11:34. Reason: missing [quote] tags
jpn, so this means QPixmap does not originate from QObject either? I am just trying to display some image in my application. So it seems QPixmap is not the right class to use. Can you recommend me which class that IS widget should I use? Hmm, maybe QLabel would be better option?
QPixmap is not GUI component. QPixmap only represents image data.
You should use one of the readily available options; QWidget, QDialog or QMainWindow. Then you will just add a QLabel widget on the form and set a pixmap on the label.I am just trying to display some image in my application. So it seems QPixmap is not the right class to use. Can you recommend me which class that IS widget should I use? Hmm, maybe QLabel would be better option?
J-P Nurmi
Yes, you are right. I did not know that I must use QLabel to display image. Now it works. Thank you very much!
Bookmarks