PDA

View Full Version : QPixmap::graWidget always getting null!



doijunior
23rd February 2010, 15:06
Hello I have some widgets that I need to save into a img, but I had some problems even before in the pixmap.
The widget is a QCalendarWidget derived class, but after had problems I tried doing this:

QCalendarWidget *c = new QCalendarWidget();
QPixmap pix;
pix.grabWidget(c);
if(pix.isNull()) qDebug("fail")

Myclass and even QCalendarWIdget, QWidget, etc.. always fail
I need to do something else inside the widget class to grab it? (I am not calling it graWidget on the paintEvent() )

Lykurg
23rd February 2010, 15:10
grabWidget() is a static function, so you have to call it like that:
pix = QPixmap::grabWidget(c);

doijunior
25th February 2010, 12:20
yeah it really was this thanks!