PDA

View Full Version : QT problem in SDL app



mickey
14th September 2006, 22:42
HI I coded and SDL app with using some QT class (QString, qdom, qiodevice).
It happen that app crash with error write/read memory and a console message like as:


QPaintDevice: Must construct a QApplication before a QPaintDevice
Press any key to continue

I haven't paint everywhere. this is a SDL app only....so what's happen? thanks

jacek
14th September 2006, 23:10
Do you create QWidget, QPixmap, QPicture or QPrinter instance anywhere in your program?

mickey
15th September 2006, 00:35
I use many time qimage declaration; but I'm using also that:


QImage txthumb = QGLWidget::convertToGLFormat(img);

Could it be the problem? thanks

jacek
15th September 2006, 00:55
I use many time qimage declaration; but I'm using also that:
QImage txthumb = QGLWidget::convertToGLFormat(img);
Could it be the problem?
IMO it shouldn't. Maybe you create QPixmap somewhere?

Methedrine
15th September 2006, 08:16
Warning: Qt requires that a QApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.


QImage, QPrinter, QPixmap etc are all derived from QPaintDevice. Therefore if you use a QImage object you must have a QApplication object.

jacek
15th September 2006, 11:57
QImage, QPrinter, QPixmap etc are all derived from QPaintDevice. Therefore if you use a QImage object you must have a QApplication object.
QImage isn't derived from QPaintDevice in Qt3.

mickey
15th September 2006, 13:36
IMO it shouldn't. Maybe you create QPixmap somewhere?
No.......that's strange....

Methedrine
15th September 2006, 19:21
QImage isn't derived from QPaintDevice in Qt3.

Agreed, my mistake. I didn't take a look at the Qt version he's using :cool:

mickey
16th September 2006, 12:20
I'm thinkng the probme isn't QT class; the console error (and quit application) happen when I use a my GL function; probabily it crash ( anyway, I wondering why qt message...)...

Methedrine
16th September 2006, 18:28
QQLWidget inherits QWidget which again inherits QPaintDevice ... there is your problem explained. :)

mickey
17th September 2006, 16:26
Hi, I change the only QGLWidget:: in my code; the problem persists.....


QImage txthumb = img;
//QImage txthumb = QGLWidget::convertToGLFormat(img); //what I wanted do!

Methedrine
17th September 2006, 17:02
Do you have a QGLWidget somewhere else in your code?

It's not just QGLWidget, but basically pay attention to what the Qt classes you are using inherit. The error message states quite clearly what does not work - constructing a QPaintDevice without a QApplication. And all QWidget based classes are using a QPaintDevice.

mickey
17th September 2006, 18:43
I haven't any QGLWIdget.....but the error occur only when I use a function that get the pick 2d mouse and return the 3d point in OPenGL coordinates (this function contain only glReadPixel and gluUnprojects). At the first pick in the window it return properly the 3d point; at the second pick, application crash inside this function...) thanks

mickey
17th September 2006, 19:09
Hi all,
I found problem; I was using a class that use <qmessagebox.h>!!! I don't remember it;
But I need use it; how can I use it in SDL app without error?? thanks

Methedrine
17th September 2006, 19:55
I have not really worked with SDL yet but the solution clearly contains a QApplication somewhere :-) Isn't there a Qt binding for SDL? If so, it should tell you about solving this problem.

Alternately get rid off the qmessagebox and replace it with some logging or output mechanism.

mit_cruze
5th October 2016, 13:02
HI I coded and SDL app with using some QT class (QString, qdom, qiodevice).
It happen that app crash with error write/read memory and a console message like as:


QPaintDevice: Must construct a QApplication before a QPaintDevice
Press any key to continue

I haven't paint everywhere. this is a SDL app only....so what's happen? thanks

Can you send me small Qt app which uses SDL libraries?