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.
query.exec( "SELECT name,number,id,identifier FROM table;" );
while( query.next() )
{
qString.sprintf("%s | %d" , query.value(0).toByteArray().data(), query.value(1).toInt() );
List .last()->setText( 0, qString );
List .last()->setWhatsThis( 0, query.value(2).toString() );
List .last()->setIcon( 0, Icon );
}
query.exec( "SELECT name,number,id,identifier FROM table;" );
while( query.next() )
{
List << new QTreeWidgetItem(sectorsNode);
qString.sprintf("%s | %d" , query.value(0).toByteArray().data(), query.value(1).toInt() );
List .last()->setText( 0, qString );
List .last()->setWhatsThis( 0, query.value(2).toString() );
List .last()->setIcon( 0, Icon );
QApplication::processEvents();
}
To copy to clipboard, switch view to plain text mode
Bookmarks