[Qt-interest] QTableWidget Selection

scott.shaw at survice.com scott.shaw at survice.com
Thu Jan 20 23:44:36 CET 2011


Hello,

I'm trying to create a table and select certain items in it and I don't
know if I'm using the most efficient method.

The way I have it set up, I traverse a tree and create a QList of QLists
of QTableWidgetItems to represent a table with 2 columns.  Then I build a
QList of QTableWidgetSelectionRanges based on which nodes in the tree are
selected.  After that, I add each item to the table.  All of what I've
done so far works fine and doesn't take long at all.  The next thing I do
is select items in the table.  I select them by iterating through the
QList of ranges I set up and pass each one to
QTableWidget->setRangeSelected().  This also works fine, but can take a
long time depending on how many items are selected, even if they are all
in one range.  Is there something I'm doing wrong in this step that's
making it take so long?

Thanks,
Scott



More information about the Qt-interest-old mailing list