diff options
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 4006601..1a8a686 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1343,39 +1343,16 @@ void QTreeViewPrivate::_q_modelDestroyed() QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const { Q_ASSERT(r); - return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r); Q_Q(const QTreeView); - QRect &rect = *r; - const QRect viewportRect = viewport->rect(); - int itemOffset = 0; - int row = firstVisibleItem(&itemOffset); - QPair<int, int> startEnd = startAndEndColumns(viewportRect); - QVector<int> columns; - for (int i = startEnd.first; i <= startEnd.second; ++i) { - int logical = header->logicalIndex(i); - if (!header->isSectionHidden(logical)) - columns += logical; - } - QSet<QModelIndex> visibleIndexes; - for (; itemOffset < viewportRect.bottom() && row < viewItems.count(); ++row) { - const QModelIndex &index = viewItems.at(row).index; - for (int colIndex = 0; colIndex < columns.count(); ++colIndex) - visibleIndexes += index.sibling(index.row(), columns.at(colIndex)); - itemOffset += itemHeight(row); - } - - //now that we have the visible indexes, we can try to find those which are selected - QItemViewPaintPairs ret; - for (int i = 0; i < indexes.count(); ++i) { - const QModelIndex &index = indexes.at(i); - if (visibleIndexes.contains(index)) { - const QRect current = q->visualRect(index); - ret += qMakePair(current, index); - rect |= current; - } - } - rect &= viewportRect; - return ret; + if (spanningIndexes.isEmpty()) + return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r); + QModelIndexList list; + foreach (const QModelIndex &idx, indexes) { + if (idx.column() > 0 && q->isFirstColumnSpanned(idx.row(), idx.parent())) + continue; + list << idx; + } + return QAbstractItemViewPrivate::draggablePaintPairs(list, r); } void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItemV4 *option, const QModelIndex ¤t) const |