equal
deleted
inserted
replaced
1578 d->policy = policy; |
1578 d->policy = policy; |
1579 |
1579 |
1580 if (!view) |
1580 if (!view) |
1581 return; |
1581 return; |
1582 |
1582 |
1583 view->viewport()->update( view->d_func()->itemDecorationRect(view->d_func()->index(this))); |
1583 view->scheduleDelayedItemsLayout(); |
1584 } |
1584 } |
1585 |
1585 |
1586 /*! |
1586 /*! |
1587 Returns the item indicator policy. This policy decides when the |
1587 Returns the item indicator policy. This policy decides when the |
1588 tree branch expand/collapse indicator is shown. |
1588 tree branch expand/collapse indicator is shown. |
2849 \sa itemAt() |
2849 \sa itemAt() |
2850 */ |
2850 */ |
2851 QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const |
2851 QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const |
2852 { |
2852 { |
2853 Q_D(const QTreeWidget); |
2853 Q_D(const QTreeWidget); |
2854 return visualRect(d->index(item)); |
2854 //the visual rect for an item is across all columns. So we need to determine |
|
2855 //what is the first and last column and get their visual index rects |
|
2856 QModelIndex base = d->index(item); |
|
2857 const int firstVisiblesection = header()->logicalIndexAt(- header()->offset()); |
|
2858 const int lastVisibleSection = header()->logicalIndexAt(header()->length() - header()->offset() - 1); |
|
2859 QModelIndex first = base.sibling(base.row(), header()->logicalIndex(firstVisiblesection)); |
|
2860 QModelIndex last = base.sibling(base.row(), header()->logicalIndex(lastVisibleSection)); |
|
2861 return visualRect(first) | visualRect(last); |
2855 } |
2862 } |
2856 |
2863 |
2857 /*! |
2864 /*! |
2858 \since 4.1 |
2865 \since 4.1 |
2859 |
2866 |