What's the difference to the default QLabel then? Although QLabel uses QPixmap, it supports all the functionality ImageViewLabel has. Are there any threads involved? In that case QImage might be the correct choice as it supports manipulating outside GUI thread. But you can still use the QLabel's built-in capabilities to show the image.
In your case when the image has not actually been set on the QLabel, QLabel::paintEvent() neither does actually paint anything (although it could draw the frame if any had been set). The reason why can't you see anything is that the ImageViewLabel doesn't request enough size for itself. If you would set the image on the QLabel, the QLabel::sizeHint() would return appropriate size hint and the label would get laid and resized correctly. Now when the QLabel doesn't actually have any content (since the image is put just as a member variable which QLabel implementation is not aware of) it doesn't request for proper size either. The simplest solution to get anything to shown is to reimplement sizeHint() and return the size of the image.
Bookmarks