Results 1 to 5 of 5

Thread: How to write qt4 gui up to the existing console

  1. #1
    Join Date
    May 2009
    Posts
    55
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to write qt4 gui up to the existing console

    Hi,

    I'm new to QT problematics and this could be maybee easy to answer. I writtenin C console app. for uploading FW to some HW but I wouldlike to add some gui for users. Console app. using libusb. I don't want to have 2 separate apps (console and gui) but just need gui for controlling console. Is there any tutorial or good example how to do this in QT?

    Thanks

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to write qt4 gui up to the existing console

    look at QProcess docs. You can run process with that class and communicate with it writing and reading in similar way to writing and reading file (both QFile and QProcess are subclasses od QIODevice).
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    May 2009
    Posts
    55
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb Re: How to write qt4 gui up to the existing console

    Hi,

    thanks for response. I try to use QProcess but I got very strange behaviour.
    I try to run dmesg from QT and it works fine (I got an output to TextEdit). When I run my external program (which printout every second something to stdout) I never get signal for reading some data from stdout.

    Code snippet:

    process.setReadChannel(QProcess::StandardOutput);
    connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(updateOutput()));
    //process.start("dmesg -s10");
    process.start("/home/marek.nandra/projects/qt/test_app/gui/process_test/test");

    Am I doing something wrong or should I wait for something else?

    Thanks in advance,

    Marek

  4. #4
    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: How to write qt4 gui up to the existing console

    Most likely you are creating the QProcess object on the stack and it gets destroyed once you leave the method you created it in. Create the object on heap instead.

    It's the same problem as here:
    http://www.qtcentre.org/forum/faq.ph...reated_widgets
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2009
    Posts
    55
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb Re: How to write qt4 gui up to the existing console

    Problem was different. In test program is necessary to call fflush(stdout) and it works fine then. Hope this will help someone . Thanks for help.

Similar Threads

  1. FSWriteFork in MAC OS to write data to a file.
    By vishal.chauhan in forum General Programming
    Replies: 5
    Last Post: 2nd July 2007, 06:48
  2. convert console to windows app
    By Max Yaffe in forum Newbie
    Replies: 1
    Last Post: 13th June 2007, 15:38
  3. Console replacement
    By aegis in forum Qt Programming
    Replies: 14
    Last Post: 3rd April 2007, 00:38
  4. how to write a structure in a shared mem segment.
    By nass in forum General Programming
    Replies: 9
    Last Post: 26th September 2006, 13:11
  5. How to run a console program "silently"?
    By fullmetalcoder in forum Qt Programming
    Replies: 9
    Last Post: 23rd July 2006, 10:03

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.