diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-01 01:00:53 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-01 01:00:54 +0100 |
commit | 7aa204d5b30d3d55ac838b4df601feaa368412b8 (patch) | |
tree | ecc155d46985f1143845d3bd13074914149f22f3 /src/widgets/itemviews/qlistview_p.h | |
parent | c47ec42f02196f387c28ab1a5ac70a23ec642a63 (diff) | |
parent | 55b464196297afc11cb9836f61f737e6fdaf04dc (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Icec0aa703d8a13efa9f1634a1a353eb9d63685c8
Diffstat (limited to 'src/widgets/itemviews/qlistview_p.h')
-rw-r--r-- | src/widgets/itemviews/qlistview_p.h | 19 |
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(); } |