Qt-interest Archive, August 2006
question about QPainter on QImage
Message 1 in thread
I have an question about QPainter on QImage, I want the QPainter to operate on QImage, and also doesn't want to init QPainter everytime when I want to modify the QImage, so I decided to store the QPainter as well as QImage in the QWidget, for example:
class MyWidget : public QWidget
{
private:
QImage* pImage;
QPainter* pPainter;
}
In Constructor I init QPainter with QImage, in the class I use QPainter whenever I want and destroy it in the class' destructor.
but there is an error when I exit from the application, the vc2003 tells me:
Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.
"app" is the QApplication instance.
It puzzles me a lot, does anybody know why so? Can't I do things like this?
Thanks a lot
Reimand
2006-08-04
Message 2 in thread
I have to add some very important details about my application.
I draw things on a QImage, and in QWidget's paintEvent, I use drawImage() to draw my QImage onto the screen.
that's what things going to be bad. I've tried invoke QImage's corresponding QPainter::end() before paintEvent, but there is
still the same error.
Reimand
2006-08-04
发件人: 0261069
发送时间: 2006-08-04 14:33:18
收件人: qt-interest@xxxxxxxxxxxxx
抄送:
主题: question about QPainter on QImage
I have an question about QPainter on QImage, I want the QPainter to operate on QImage, and also doesn't want to init QPainter everytime
when I want to modify the QImage, so I decided to store the QPainter as well as QImage in the QWidget, for example:
class MyWidget : public QWidget
{
private:
QImage* pImage;
QPainter* pPainter;
}
In Constructor I init QPainter with QImage, in the class I use QPainter whenever I want and destroy it in the class' destructor.
but there is an error when I exit from the application, the vc2003 tells me:
Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.
"app" is the QApplication instance.
It puzzles me a lot, does anybody know why so? Can't I do things like this?
Thanks a lot
Reimand
2006-08-04
Message 3 in thread
As said by you
"In Constructor I init QPainter with QImage, in the class I use QPainter whenever I want and destroy it in the class' destructor."
This means that QImage is now a child object of QPainter, so as per QT, parent object is responsible for the deletion the child object, when ever the child goes out of scope, and this is automatic, i.e. QT will itself take care of it.
No manual deletion is necessary.
Can u give more details about the code in the main function. If possible the complete source this will allow us to pin point the exact issue.
Srinivasa Raju
-----Original Message-----
From: Reimand [mailto:0261069@xxxxxxxxxxxx]
Sent: Friday, August 04, 2006 12:29 PM
To: 0261069
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: question about QPainter on QImage
I have to add some very important details about my application.
I draw things on a QImage, and in QWidget's paintEvent, I use drawImage() to draw my QImage onto the screen.
that's what things going to be bad. I've tried invoke QImage's corresponding QPainter::end() before paintEvent, but there is
still the same error.
Reimand
2006-08-04
åääï 0261069
åéæéï 2006-08-04 14:33:18
æääï qt-interest@xxxxxxxxxxxxx
æéï
äéï question about QPainter on QImage
I have an question about QPainter on QImage, I want the QPainter to operate on QImage, and also doesn't want to init QPainter everytime
when I want to modify the QImage, so I decided to store the QPainter as well as QImage in the QWidget, for example:
class MyWidget : public QWidget
{
private:
QImage* pImage;
QPainter* pPainter;
}
In Constructor I init QPainter with QImage, in the class I use QPainter whenever I want and destroy it in the class' destructor.
but there is an error when I exit from the application, the vc2003 tells me:
Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.
"app" is the QApplication instance.
It puzzles me a lot, does anybody know why so? Can't I do things like this?
Thanks a lot
Reimand
2006-08-04
Nçzuåæîææåååyéåæâæææ
--
[ signature omitted ]