Results 1 to 17 of 17

Thread: Too slow adding & defining items to QTreeWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Too slow adding & defining items to QTreeWidget

    WinXP
    QT4.0.1

    The code below fills a QTreeWidget with items from a table in my database. I set the text so users can identify the name and set the WhatsThis to the id of the row so I know which one was selected by the user.

    I'll take any advice to speed this up in any way. The table can have anywhere from 10-2000 entries. If i remove the text, WhatsThis, and icon it speeds things up by a factor of 10. This is really kicking my butt. Any help would be greatly appreciated.

    Qt Code:
    1. query.exec( "SELECT name,number,id,identifier FROM table;" );
    2.  
    3. while( query.next() )
    4. {
    5. List << new QTreeWidgetItem(sectorsNode);
    6. qString.sprintf("%s | %d" , query.value(0).toByteArray().data(), query.value(1).toInt() );
    7. List .last()->setText( 0, qString );
    8. List .last()->setWhatsThis( 0, query.value(2).toString() );
    9. List .last()->setIcon( 0, Icon );
    10. QApplication::processEvents();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jnk5y; 11th May 2006 at 19:47.

Similar Threads

  1. Removing items properly from qtreewidget item
    By Djony in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2006, 12:20

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.