QPaintDevice: Must construct a QApplication before a QPaintDevice

Diez B. Roggisch deets at nospam.web.de
Tue Feb 27 06:35:09 EST 2007


boris.smirnov at gmail.com wrote:

> On Feb 27, 11:56 am, "Diez B. Roggisch" <d... at nospam.web.de> wrote:
>> > Yes that I can deduce, but why I'm asking is why it's different on
>> > Windows and Linux. Should it not be platform independent?
>>
>> It should be. I've got no idea why it seems to work on windows but I can
>> say one thing for sure: that would be an artifact that you shouldn't rely
>> on. In Qt, you _always_ need a QApplication for anything. So just do as
>> it requires you to do: first, construct a QApplication. Then things will
>> work.
>>
>> Diez
> 
> Hmm, as I see the code, I do construct QApplication as first
> 
> if __name__ == '__main__':
>   a = QApplication (sys.argv)
>   mywidget = Optimizer()
>   a.setMainWidget (mywidget)
>   mywidget.show()
>   Update_StatusLine(mywidget)
>   mywidget.setStartconfig()
>   a.exec_loop     ()

I don't see any QPaintDevice here. Where does that come from? You need to
give more information, a stack trace and a reduced example exhibiting the
behaviour.

Diez



More information about the Python-list mailing list