Raccoon29
4th September 2007, 16:31
Hi everyone,
I know this is a nooby problem, and however I'm a Qt noob...
My application has a window that loads an image and stores it in a QPixmapLabel.
Then there is a button that pressed should rotate the loaded image of 27 degrees.
The problem is that the first time it works perfectly, the second push (doing nothing else
in the meanwhile) shows an exception, and crushes the program. :confused:
Here I report the routine that fails:
QPicture pic;
QPainter paint;
QPixmap *pix=pxldest->pixmap();
if(paint.begin(&pic))
{
paint.rotate(27);
paint.drawPixmap(0,0,*pix);
paint.end();
pxldest->setPicture(pic);
QMessageBox::information(this,"Rotated","Image rotated");
}
"pxldest" is the QPixmapLabel's name. Note that the exception is thrown by the line 8 during the second rotation.
I would appreciate any sort of tip or warn about this code
and thank you in advance to all will help!
I know this is a nooby problem, and however I'm a Qt noob...
My application has a window that loads an image and stores it in a QPixmapLabel.
Then there is a button that pressed should rotate the loaded image of 27 degrees.
The problem is that the first time it works perfectly, the second push (doing nothing else
in the meanwhile) shows an exception, and crushes the program. :confused:
Here I report the routine that fails:
QPicture pic;
QPainter paint;
QPixmap *pix=pxldest->pixmap();
if(paint.begin(&pic))
{
paint.rotate(27);
paint.drawPixmap(0,0,*pix);
paint.end();
pxldest->setPicture(pic);
QMessageBox::information(this,"Rotated","Image rotated");
}
"pxldest" is the QPixmapLabel's name. Note that the exception is thrown by the line 8 during the second rotation.
I would appreciate any sort of tip or warn about this code
and thank you in advance to all will help!