Results 1 to 6 of 6

Thread: QT4 console apps

  1. #1
    Join Date
    Jan 2006
    Posts
    44
    Thanks
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default QT4 console apps

    Anyone here done this yet? GIven all the hoopla about TT making this "easy" I'd expect some tutorials and/or an example of a console only app.

    Anyone have links/pointers? (preferably involving QObjects, Timers, and signal/slot )

    Cheers,
    Bill

  2. #2
    Join Date
    Jan 2006
    Posts
    21
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4 console apps

    Just use QCoreApplication instead QApplication. All works fine.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4 console apps

    you have to change the CONFIG var in your .pro file
    CONFIG += console
    CONFIG -= gui

    Look at the doc, I'm unsure about the vars that has to hold "console" property.
    Current Qt projects : QCodeEdit, RotiDeCode

  4. #4
    Join Date
    Jan 2006
    Posts
    21
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT4 console apps

    I have used:
    Qt Code:
    1. QT = core sql
    To copy to clipboard, switch view to plain text mode 
    in my .pro file. This gets core features (QtCore) and SQL features (QtSql).

  5. #5
    Join Date
    Jan 2006
    Posts
    44
    Thanks
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: QT4 console apps

    Thanks everyone. I was trying to use QCoreApplication but had the order of exec compared to other code in the wrong place. "Minor" refactoring and voila! I get to move on to other issues.

    Side note:
    By including QApplication you get qApp(), but there is no comparable (that I have found) ability in QCoreApplication. Sure, I can include QApplication to get it but that seems a bit extreme and naturally requires the gui libraries. Or am I missing something?

  6. #6
    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: QT4 console apps

    QCoreApplication::instance()

Similar Threads

  1. convert console to windows app
    By Max Yaffe in forum Newbie
    Replies: 1
    Last Post: 13th June 2007, 16:38
  2. Console replacement
    By aegis in forum Qt Programming
    Replies: 14
    Last Post: 3rd April 2007, 01:38
  3. How to run a console program "silently"?
    By fullmetalcoder in forum Qt Programming
    Replies: 9
    Last Post: 23rd July 2006, 11:03
  4. QPainter in console apps?
    By Funklord in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2006, 15:03
  5. Console apps in Kde Qt
    By peedarp in forum Qt Programming
    Replies: 5
    Last Post: 1st February 2006, 11:43

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.