You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

hylke

Trainee

  • "hylke" is male
  • "hylke" started this thread

Posts: 123

Location: Netherlands

Occupation: Student

  • Send private message

1

Saturday, August 13th 2005, 12:56pm

Debugging

Hello,
When I run my program I'm getting this error:

Quoted

QPaintDevice: Must construct a QApplication before a QPaintDevice

I know it meens that I'm drawing something, but my windows isn't created yet.
Because my program is quite large(lots of classes), I haven't found the place where the problem is caused.
So my question is, is there some tool/debugger that can help me trace the place in which the error is caused(in example, in which function)?
Thanx in advance,
Hylke
Duh

dimitri

Professional

  • "dimitri" is male

Posts: 1,311

Occupation: Engineer

  • Send private message

2

Saturday, August 13th 2005, 4:58pm

RE: Debugging

Use a debugger and put a breakpoint in the Qt library where the error message is printed. Unfortunately you need a debug Qt library for that.

hylke

Trainee

  • "hylke" is male
  • "hylke" started this thread

Posts: 123

Location: Netherlands

Occupation: Student

  • Send private message

3

Sunday, August 14th 2005, 8:44am

So there's no easy way to 'just' debug it?
Duh

hylke

Trainee

  • "hylke" is male
  • "hylke" started this thread

Posts: 123

Location: Netherlands

Occupation: Student

  • Send private message

4

Sunday, August 14th 2005, 9:31am

valgrind was the tool that I was looking for.
It found the exact place.
Duh

dimitri

Professional

  • "dimitri" is male

Posts: 1,311

Occupation: Engineer

  • Send private message

5

Sunday, August 14th 2005, 9:34am

Maybe it works without a debug version of the Qt library. Try adding a breakpoint in the QWidgetPrivate constructor - provided the QPaintDevice is a QWidget. By the way, I can't find the error message you're refering too in the Qt sources:

Quoted

QPaintDevice: Must construct a QApplication before a QPaintDevice

I was only able to find:

Quoted

QPixmap: Must construct a QApplication before a QPaintDevice
QWidget: Must construct a QApplication before a QPaintDevice
QPrinter: Must construct a QApplication before a QPaintDevice

hylke

Trainee

  • "hylke" is male
  • "hylke" started this thread

Posts: 123

Location: Netherlands

Occupation: Student

  • Send private message

6

Sunday, August 14th 2005, 10:18am

Thank you for yout reply.
But valgrind was all I needed :-)
Duh

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

7

Sunday, August 14th 2005, 11:27am

Just for the interested:

This usually happend if one has a static member which is a QPaintDevice.

It gets created before the main() functions executes and creates the QApplication instance.

Cheers,
_
Qt/KDE Developer
Debian User