Results 1 to 4 of 4

Thread: Simulating a console window

  1. #1
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Simulating a console window

    Is there a way to implement a "stdout" type of widget in Qt, e.g., a textbox type window that either printf() output would go to (like a terminal) or sprintf() character buffers?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Simulating a console window


  3. #3
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Simulating a console window

    Check out qt-interest 2004-03. The last two messages have two different interesting solutions.

  4. #4
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Arrow Re: Simulating a console window

    Hi,

    I ran into a similar problem, but haven't found a working solution yet.

    Under the hood of my Qt application I'm using a special purpose library were a cannot change the code. It uses printf() to output errors and warnings.
    What I want to do is catch those printf's and print them into a QPlainTextEdit.
    I need a solution for Windows and Linux.

    On Windows I tried this:
    Qt Code:
    1. // Create a pipe
    2. HANDLE hPipe = CreateNamedPipe("\\\\.\\pipe\\MyPipeNameHere", PIPE_ACCESS_OUTBOUND | WRITE_DAC,
    3.  
    4. PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1,
    5.  
    6. 1024, 1024, 2000, NULL);
    7.  
    8. // let a SocketNotifier watch that pipe
    9. QSocketNotifier* notifier = new QSocketNotifier((int)hPipe, QSocketNotifier::Read);
    10.  
    11. connect(notifier, SIGNAL(activated(int)), SLOT(outputReceived()));
    To copy to clipboard, switch view to plain text mode 

    But I don't receive anything on that slot.

Similar Threads

  1. Replies: 3
    Last Post: 23rd July 2006, 18:02
  2. How to run a console program "silently"?
    By fullmetalcoder in forum Qt Programming
    Replies: 9
    Last Post: 23rd July 2006, 10:03
  3. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22
  4. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21
  5. qt without console window
    By jh in forum Qt Programming
    Replies: 3
    Last Post: 28th January 2006, 20:01

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.