Results 1 to 16 of 16

Thread: QT problem in SDL app

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default QT problem in SDL app

    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:
    Qt Code:
    1. QPaintDevice: Must construct a QApplication before a QPaintDevice
    2. Press any key to continue
    To copy to clipboard, switch view to plain text mode 
    I haven't paint everywhere. this is a SDL app only....so what's happen? thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    Do you create QWidget, QPixmap, QPicture or QPrinter instance anywhere in your program?

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    I use many time qimage declaration; but I'm using also that:
    Qt Code:
    1. QImage txthumb = QGLWidget::convertToGLFormat(img);
    To copy to clipboard, switch view to plain text mode 
    Could it be the problem? thanks
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    Quote Originally Posted by mickey
    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?

  5. #5
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    Quote Originally Posted by Qt Assistant
    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.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    Quote Originally Posted by Methedrine
    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.

  7. #7
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    Quote Originally Posted by jacek
    IMO it shouldn't. Maybe you create QPixmap somewhere?
    No.......that's strange....
    Regards

  8. #8
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    Quote Originally Posted by jacek
    QImage isn't derived from QPaintDevice in Qt3.
    Agreed, my mistake. I didn't take a look at the Qt version he's using

  9. #9
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    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...)...
    Regards

  10. #10
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    QQLWidget inherits QWidget which again inherits QPaintDevice ... there is your problem explained.

  11. #11
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    Hi, I change the only QGLWidget:: in my code; the problem persists.....
    Qt Code:
    1. QImage txthumb = img;
    2. //QImage txthumb = QGLWidget::convertToGLFormat(img); //what I wanted do!
    To copy to clipboard, switch view to plain text mode 
    Regards

  12. #12
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    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.

  13. #13
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    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
    Regards

  14. #14
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QT problem in SDL app

    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
    Regards

  15. #15
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT problem in SDL app

    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.

  16. #16
    Join Date
    Oct 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QT problem in SDL app

    Quote Originally Posted by mickey View Post
    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:
    Qt Code:
    1. QPaintDevice: Must construct a QApplication before a QPaintDevice
    2. Press any key to continue
    To copy to clipboard, switch view to plain text mode 
    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?

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.