Results 1 to 2 of 2

Thread: Howto convert console Application to QT UI - what's the concept?

  1. #1

    Question Howto convert console Application to QT UI - what's the concept?

    Hi,

    I have to say that I am a complete Noob to UI programming. I prefere background development.

    Anyway I have a console application which runs for 10min and has a lot of console text output. The application does what it should but if others want to use it it should be more user firendly. E.g. there are a lot of parameters which have to be change in source code currently.

    That's why I want to add a UI and I chose QT.

    But I've some problems understanding the concepts. To start I have created a small app with just one button and a plaintextedit (PTE).

    In button->clicked() I can add another text line to the PTE.

    But actually with the click of the button I want to run my core algorithm and want to send a lot of updates to the PTE. (use it as console).

    So I added a 10000 time loop in button->clicked() and in each loop another line is added. I also added QCoreApplication::instance()->flush(); in each loop and hoped to see immediatelly updates.

    But it only updates if clicked() is left.

    How should it be done correctly? I think I miss something...

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Howto convert console Application to QT UI - what's the concept?

    GUI will not be updated until your function returns, so you need to change your program completely. Put your algorithm in a thread, tell it to send a signal to your main thread everything time it has something to output and have your main thread to capture this signal and output text to PTE.

Similar Threads

  1. about console application
    By jirach_gag in forum Qt Programming
    Replies: 2
    Last Post: 5th January 2012, 11:39
  2. Writing a Qt console application
    By sashoalm in forum Newbie
    Replies: 6
    Last Post: 7th February 2011, 17:42
  3. print something on console application
    By cemtopkaya in forum Qt Programming
    Replies: 2
    Last Post: 10th June 2010, 13:41
  4. Console application suspense
    By TheGrimace in forum Newbie
    Replies: 6
    Last Post: 1st October 2007, 14:52
  5. convert console to windows app
    By Max Yaffe in forum Newbie
    Replies: 1
    Last Post: 13th June 2007, 15:38

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.