Results 1 to 9 of 9

Thread: Any way to output values to some QT output ?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Any way to output values to some QT output ?

    Is it possible to make some 'cout' to some place sited at QTCreator ?
    In case of not, can I create a console window to do this ? (in a QT gui application)
    Any idea ?
    Thanks

  2. #2
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to output values to some QT output ?

    Hi tonnot,
    You don't have to create a console. Just use qDebug << "output" ; it will print the data to "Application Output" window which usually shows you the errors in the app. Also include #include <QDebug> library before using the command.

    Baluk

  3. #3
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to output values to some QT output ?

    Ok. Thank you.
    And what happens when I compile my exe and I give it to my client ?

  4. #4
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any way to output values to some QT output ?

    You can't show him the output window. It is for developer sake to check the application is fine. When it is handed to client you can only show him the output on the GUI by using some "Label" widget etc. .

    Baluk

  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Any way to output values to some QT output ?

    if i remember correctly ... there is a qmake value "QT += console" or something. But i haven't tried that.

  6. #6
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Any way to output values to some QT output ?

    Hi,
    this is very simple. Just write:
    Qt Code:
    1. include <iostream>;
    2. using namespace std;
    To copy to clipboard, switch view to plain text mode 

    write:
    Qt Code:
    1. cout << doubleVariable << endl;
    To copy to clipboard, switch view to plain text mode 

    In Qt: switch to application output, this will be the result which will be shown in a linux or dos console.


    greetz A.
    Attached Images Attached Images

  7. #7
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Any way to output values to some QT output ?

    Quote Originally Posted by tonnot View Post
    Ok. Thank you.
    And what happens when I compile my exe and I give it to my client ?
    In release mode, qDebug() will not output anything.

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Any way to output values to some QT output ?

    Quote Originally Posted by MrDeath View Post
    if i remember correctly ... there is a qmake value "QT += console" or something. But i haven't tried that.
    That's important on Windows.

    Better operating systems don't need this :-)

  9. #9
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Any way to output values to some QT output ?

    Just read about message handler.

Similar Threads

  1. Can't get QProcess output
    By croscato in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2010, 15:56
  2. How can i get the mentioned output
    By namus in forum Newbie
    Replies: 1
    Last Post: 25th June 2010, 21:59
  3. Why am I not seeing qDebug() output?
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 24th January 2009, 11:54
  4. OpenOffice Output
    By KaptainKarl in forum General Discussion
    Replies: 1
    Last Post: 12th April 2007, 15:54
  5. output UTF?
    By mikro in forum Newbie
    Replies: 4
    Last Post: 18th May 2006, 23:00

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.