Results 1 to 5 of 5

Thread: Suggestion needing regarding displaying large number of items one-by-one

  1. #1
    Join Date
    Jun 2009
    Posts
    38
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Suggestion needing regarding displaying large number of items one-by-one

    Hi all,

    Can anyone suggest me what will be an efficient way to generate approximately 100 qgraphics items (e.g. squares or rectangles) 'one-by-one'?

    What i do now is that i just call an object of my class (responsible for generating the items) 100 times using a for-loop. But when i run my application all the items appear at the same time after a little pause.

    What should i do to make them appear one-by-one?


  2. #2
    Join Date
    Apr 2009
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Post Re: Suggestion needing regarding displaying large number of items one-by-one

    start a timer.
    call to display item when timer is elapsed say 100ms

  3. #3
    Join Date
    Jun 2009
    Posts
    38
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Suggestion needing regarding displaying large number of items one-by-one

    Nah...timer isn't working for me. i create shapes by making object of my class named sqMap

    Qt Code:
    1. ...
    2. ...
    3. square = new sqMap(tempWidth, tempHeight);
    4. ...
    5. /*
    6. QTimer *timer = new QTimer(this);
    7. timer->start(1000);
    8. */
    9. ...
    10. ...
    To copy to clipboard, switch view to plain text mode 


    If timer is used nothing seems to happen. My shapes still not appearing one-by-one even if i set the timer to 10000. It seems like the timer is not working in first place because i get output very early than 10000 msec.

    Am i using the timer wrongly?
    Is there any other way?
    Will QThread do the magic?

    Thanks

  4. #4
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Suggestion needing regarding displaying large number of items one-by-one

    You should connect the timers' signal timeout() to a slot that displays the newly created item.

  5. #5
    Join Date
    Jun 2009
    Posts
    38
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Re: Suggestion needing regarding displaying large number of items one-by-one

    Still no success. All items appear at a same time.

    Following is a snippet from my code.

    Qt Code:
    1. for(int j = 0; j < 200 ; j++)
    2. {
    3. ...
    4. ...
    5. makeAshape(tempWidth,tempHeight,j);
    6. QTimer *timer = new QTimer(this);
    7. connect(timer, SIGNAL(timeout()), this, SLOT(makeAshape()));
    8. timer->start(1000);
    9. ...
    10. ...
    11. }
    12.  
    13. void MainWindow::makeAshape(double tempWidth, double tempHeight, int j)
    14. {
    15. square = new sqMap(tempWidth, tempHeight, processInfoVector[j], tableView_processInfo, tableView_filesInfo);
    16. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QScrollArea not displaying large number of images
    By lpkincaid in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2009, 10:58
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13

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.