diff options
author | Stephen Bowline <sbowline@ilm.com> | 2010-08-16 21:38:11 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-27 12:37:43 (GMT) |
commit | d34287af6fc1c7558e8ed15dbb29c0e6b58b7b00 (patch) | |
tree | 67968ca82cb7be560bb61e1ddd38f1958d5483d2 /src/gui/itemviews/qtableview.cpp | |
parent | 708978d1c18cf938a4e0c29a5a90be5de4e82140 (diff) | |
download | Qt-d34287af6fc1c7558e8ed15dbb29c0e6b58b7b00.zip Qt-d34287af6fc1c7558e8ed15dbb29c0e6b58b7b00.tar.gz Qt-d34287af6fc1c7558e8ed15dbb29c0e6b58b7b00.tar.bz2 |
QAbstractItemView: optimize handling of editors for view with large numbers of editors.
This change improves algorithmic time complexity for item views during
operations which directly (or indirectly such as layout) require
bi-directional lookups between model indices and persistent editor widgets.
The previous implementation scaled as O(n^2) due to the unordered search
through a QVector.
Implementations that use large numbers of persistent editors are most
dramatically improved. In one "real world" test case with 648 persistent
editors, profiling indicates an improvement of layout from 45 seconds
to 8 seconds with this change alone.
Reviewed-by: Olivier Goffart
Merge-Request: 2452
Diffstat (limited to 'src/gui/itemviews/qtableview.cpp')
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index e9e2e38..d8fef55 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -2159,7 +2159,7 @@ int QTableView::sizeHintForRow(int row) const option.rect.setWidth(columnWidth(index.column())); } - QWidget *editor = d->editorForIndex(index).editor; + QWidget *editor = d->editorForIndex(index).widget.data(); if (editor && d->persistent.contains(editor)) { hint = qMax(hint, editor->sizeHint().height()); int min = editor->minimumSize().height(); @@ -2212,7 +2212,7 @@ int QTableView::sizeHintForColumn(int column) const continue; index = d->model->index(logicalRow, column, d->root); - QWidget *editor = d->editorForIndex(index).editor; + QWidget *editor = d->editorForIndex(index).widget.data(); if (editor && d->persistent.contains(editor)) { hint = qMax(hint, editor->sizeHint().width()); int min = editor->minimumSize().width(); |