Results 1 to 6 of 6

Thread: Qt containers

  1. #1
    Join Date
    Apr 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt containers

    I made a project in Qt, I took a listwidget container and a pushbutton and on the click of a button , i am filling dat listwidget using additem action, i am filling 100 chars in 1 click using a loop, now what hapng is that when i click on the buton i see those 100 chars but i want a continuous o/p like the one console provides i.e. printing of characters one by one, then i used sleep function after the line ui->listwidget->additem(char), then it starts sleeping for the gien time on the mainwindow show and still it gives 100 chars in one time, what is the solution

  2. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt containers

    Use a QTimer.

  3. #3
    Join Date
    Apr 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt containers

    but my input is variable and Qtimer will print the same input again and again

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt containers

    What boudie meant is that you could use a timer to advance through your input instead of a loop.

    Basically you would be replacing a tight for/while loop with processing one input at each iteration of the event loop.

    Your current tight loop processes all input items in one go without giving the listview a chance to update its visualisation. Which results in the observed behavior of all items appearing in one go.
    By returning to the event loop each time you've added an item you allow the view to update its drawing for each item add.

    Cheers,
    _

  5. #5
    Join Date
    Apr 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt containers

    Yeah thanks previous issue solved but now a new one, using Qtimer, i can print about 5000 statements in a minute without giving any delay in the timer start event but the speed of my input is around 100 times more than that i.e. around 5,00,000 statements per minute


    Added after 4 minutes:


    i better make my question simple, i want to flush the output of a c file in gui and the output will be half a million statements per minute and i want to see them in GUI the same way we see them on a console, how should i proceed
    Last edited by Ashish Bhasin; 14th April 2014 at 12:10.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt containers

    A list widget might be the wrong widget for that.

    Have you tried a QTextBrowser?

    Cheers,
    _

Similar Threads

  1. Best way to represent struct using Qt containers
    By rajil.s in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2012, 18:30
  2. Containers and return values
    By tuamadre71 in forum Newbie
    Replies: 0
    Last Post: 15th January 2012, 12:04
  3. About STL containers and QT equivalent
    By tonnot in forum Qt Programming
    Replies: 7
    Last Post: 11th February 2011, 14:17
  4. Adding signals to qt containers
    By piotr.dobrogost in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2010, 20:58
  5. Qt containers or STL containers?
    By sparticus_37 in forum Newbie
    Replies: 2
    Last Post: 11th May 2010, 15:12

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.