summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qlistview_p.h
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-01 01:00:53 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-01 01:00:54 +0100
commit7aa204d5b30d3d55ac838b4df601feaa368412b8 (patch)
treeecc155d46985f1143845d3bd13074914149f22f3 /src/widgets/itemviews/qlistview_p.h
parentc47ec42f02196f387c28ab1a5ac70a23ec642a63 (diff)
parent55b464196297afc11cb9836f61f737e6fdaf04dc (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'src/widgets/itemviews/qlistview_p.h')
-rw-r--r--src/widgets/itemviews/qlistview_p.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 3f997ef7e3..c6810f8fdc 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -333,14 +333,31 @@ public:
inline QModelIndex listViewItemToIndex(const QListViewItem &item) const
{ return model->index(commonListView->itemIndex(item), column, root); }
+ inline bool hasRectForIndex(const QModelIndex &index) const
+ {
+ return isIndexValid(index) && index.parent() == root && index.column() == column && !isHidden(index.row());
+ }
+
QRect rectForIndex(const QModelIndex &index) const
{
- if (!isIndexValid(index) || index.parent() != root || index.column() != column || isHidden(index.row()))
+ if (!hasRectForIndex(index))
return QRect();
executePostedLayout();
return viewItemRect(indexToListViewItem(index));
}
+ QRect cellRectForIndex(const QModelIndex &index)
+ {
+ if (!hasRectForIndex(index))
+ return QRect();
+ executePostedLayout();
+ auto oldItemAlignment = itemAlignment;
+ itemAlignment = Qt::Alignment();
+ const QRect rect = rectForIndex(index);
+ itemAlignment = oldItemAlignment;
+ return rect;
+ }
+
void viewUpdateGeometries() { q_func()->updateGeometries(); }