I am trying to implement a sort of a ThumbnailView for arbitrary widgets like QTabWidget. Now, if I try to grab a Pixmap from a widget that has not been shown so far (like a tab), this results in a wierd pixmap being returned by QPixmap::grabWidget(). If the Widget was displayed once, however, the method returns a proper pixmap. This is probably caused by the fact that no paintEvent has been triggered for the Widgets in question but I am not sure.

Is there a way to work around this? I have included a compilable app highlighting the problem. In thumbnailmode you can doubleclick the items to let them take a new pixmap. Do this for tabs that were displayed and compare with those not displayed yet (i.e. tabs whose associated widget were not shown yet).

Unfortunately the example code became too large (~270 lines) and too ugly which defeats the purpose of being minimal and thus is not very easy to comprehend. I have attached it to this post nonetheless.

Thanx in advance

main.cpp