Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with function that redirects std::cout to QTextEdit

Problem with function that redirects std::cout to QTextEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 403 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oracle3001
    wrote on last edited by oracle3001
    #1

    I found this old Qt forum post that outlines a function to redirect std::cout to a QTextEdit.

    http://www.qtforum.org/article/39768/redirecting-std-cout-std-cerf-qdebug-to-qtextedit.html

    However, I found that if you have something like the following, it doesn't redirect the variable value (unless you recast explictly to a string) and so in the textbox all you get is "Test".

    int i = 0 ;
    std::cout << "Test" << i << std:endl ;

    Any ideas why it isn't redirecting the variable value?

    I am aware there is an older incarnation of this idea here,

    http://stackoverflow.com/questions/10308425/redirect-stdcout-to-a-qtextedit

    and that works perfectly. But obviously it is more inefficient.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved