Results 1 to 3 of 3

Thread: QPainter in console apps?

  1. #1
    Join Date
    Feb 2006
    Location
    Stockholm
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QPainter in console apps?

    Is it possible to use QPainter and QPaintDevice classes in a console app?

    First, I was getting the error "cannot connect to X server" when trying to run the app from a script (which is correct, there is no X server to connect to)

    When I rebuild the program as a console app using QCoreApplication instead of QApplication I get a segfault when accessing these classes.

    Why do I ask?
    Because a lot of the documentation points to the possibility that QPainter may not work without X since it may require portions of it at runtime for font rendering etc?
    (However, this does seem ridiculous, since a lot of things these classes are useful for, aren't GUI oriented at all)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPainter in console apps?

    Quote Originally Posted by Funklord
    Is it possible to use QPainter and QPaintDevice classes in a console app?
    Not without an X-server connection. It's a limitation of Qt. Let's hope it'll be lifter or an alternative approach for painting on QImage will be introduced.

  3. #3
    Join Date
    Feb 2006
    Location
    Stockholm
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPainter in console apps?

    Hmm.. I will have to draw things manually then..
    I hope at least QImage will work without X11... else I need to do bitmap/png routines as well.

    I'll go on a search spree for an easily packagable font renderer
    This is the hardest part IMO since the fonts that need to be rendered are not known beforehand, so it needs to support just about all font types.

Similar Threads

  1. How to run a console program "silently"?
    By fullmetalcoder in forum Qt Programming
    Replies: 9
    Last Post: 23rd July 2006, 10:03
  2. Replies: 7
    Last Post: 20th March 2006, 20:03
  3. Console apps in Kde Qt
    By peedarp in forum Qt Programming
    Replies: 5
    Last Post: 1st February 2006, 10:43
  4. QT4 console apps
    By ucntcme in forum Newbie
    Replies: 5
    Last Post: 24th January 2006, 10:18

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.