[Qt-interest] Render hidden widget to QPixmap

Liebe Markus (RtP2/TEF72) Markus.Liebe at de.bosch.com
Tue Feb 9 11:09:45 CET 2010


Hi Girish,

Sorry for the direct reply. I am sending to the mailinglist now.

> QWidget::render() is supposed to work on hidden widgets. If it doesn't
> please report a bug in the Qt tracker.

Well it seems to me as if it does not work. I'll test again with Qt 4.6.1 because at the moment I am using 4.6.0.
Depending on the results I will report a bug in the Qt tracker.
As Alex proposed I had a try with the Qpixmap::grabWidget() function, but that did not work, too. Even though it was better than Qwidget::render() because It got half the widget rendered (as from left to right of the widget) and kept the rest plain gray as well.

> As a work around, maybe you can display your widget somewhere outside
> the screen and then call render :-) ?

That is exactly what I am doing now. It works, but seems kindof hacky to me ;-)

P.S. For the interested: I am trying to let a QDockWidget slide in from the bottom. To reach this goal I render the QDockWidget on a Qpixmap,
Put the Pixmap on a Frameless Widget with Qt::Tool set and then use QPropertyAnimation to slide it in from the bottom. As soon as it reaches the position of the QDockWidget I hide the Widget and show the QDockWidget. Works like a charm =)

Regards,

Markus




More information about the Qt-interest-old mailing list