From 658e42e77a00596b63823482c9b77644556b647c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 6 Dec 2012 10:42:53 +0100 Subject: QTreeView - allow users to control data in the treestructure This patch allows to set which logical index the tree is in. Before the tree always displayed data from the logical index 0, but it is actually more likely that the user wants to have data from visual index 0 (which can be done by special value -1). There is nothing special about logical index 0, and not being able to change the tree-data is just annoying. Change-Id: Ib070ce93343a0d2fbac3ad5a42cb4359401ac87c Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qtreeview_p.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/widgets/itemviews/qtreeview_p.h') diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h index 8be9c568d3..89de435606 100644 --- a/src/widgets/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -91,10 +91,16 @@ public: expandsOnDoubleClick(true), allColumnsShowFocus(false), current(0), spanning(false), animationsEnabled(false), columnResizeTimerID(0), - autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false), hasRemovedItems(false) {} + autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false), hasRemovedItems(false), + treePosition(0) {} ~QTreeViewPrivate() {} void initialize(); + int logicalIndexForTree() const; + inline bool isTreePosition(int logicalIndex) const + { + return logicalIndex == logicalIndexForTree(); + } QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex ¤t) const; @@ -252,6 +258,9 @@ public: // If we should clean the set bool hasRemovedItems; + + // tree position + int treePosition; }; QT_END_NAMESPACE -- cgit v1.2.3