For better typesafety on the user side (and optional) for items with uniformly
typed children. Use it for UniformTreeModels, and consequently WatchModel
to get rid of some of the static_casts there.
Change-Id: Ic20e507036e180c24997b236230f0f71b285202c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
In uniform trees the type of the items is fixed and known,
no need for user code to cast around.
Change-Id: Id20e507036e180c24997b236230f0f71b285202c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This adds a templated layer on top of TreeModel that can specify
item types for the top three layers in the model, relieving user
code from some of the previously necessary type casting.
Two common setups get an extra layer with convenience functions
on top: TwoLevelTreeModel for two-level model with a first level
of static headers and a uniform second level, and UniformTreeModel
where all non-root nodes are the same.
"Untyped" plain TreeModels are still possible.
The walkTree() feature and untyped iteration in the base
TreeItem and TreeModel is retained for now to ease transition
in downstream modules, but is planned to be removed soon.
Change-Id: I67d75a1a4e18e8f254dbfb458db03510d8990d8b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Use function objects to apply directly during a depth-first
walk of the tree instead of faking a flat container of tree
nodes. Less code, and allows even some non-const operations.
Change-Id: I804ab11df358fe937b40809cbcb772e6f3ff8dc5
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Left over from the original implementation used for the VariableChooser.
Change-Id: I164cb306815823c988b6d79966f007298f6d1e59
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This should not be accessible to client code, as the
property is effectively managed by the owning model
and manually changing it on an item breaks that.
Change-Id: Ie04451be3c0e51e7c796dcd64d400600f035fa08
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
The usual Qt API for "takeXyz()" methods is to return the item that was
"taken".
Change-Id: Ie144051801487a301b3f13e2857735b65f58150b
Reviewed-by: hjk <hjk@theqtcompany.com>
isLazy/populate was the first incarnation of the canFetchMore/
fetchMore mechanism which now can take over completely. So:
- remove isLazy/populate
- the use in VariableChooser
Change-Id: I885d492c134fb6899759e19a73156b52df7a880a
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
... in WatchHandler and DebuggerEngine interface.
Adjust using code.
Change-Id: I6371f3e96ba46a783e23a5767cdde24a10d3fce7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Broke after moving to Utils::TreeModel. Use QSortFilterProxyModel on top
of TreeModel (can later be used for filtering as well).
Additionally we need to make sure to report changes only for the changed
column now, because otherwise QSortFilterProxyModel thinks that the
change could make re-sorting necessary, and does that in a non-stable
way.
Change-Id: I9fd12c55a45aba4c05f8e318ae8ea9a4ab9f3310
Task-number: QTCREATORBUG-14107
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Functions that are meant to be overridden should be virtual.
Also add a convience level() function, seems to be a common need.
Change-Id: I09d452ab12f0ac29fb31de853057511418a47e7e
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
The circle closes, that's where the code came from.
Change-Id: Ic36ab61ec8886c9a2747aeb29a7245df3ef0b6c4
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Default to 'editable' (not selectable), intentionally changes behavior
in the Kits, Compilers and Debugger option pages, but brings it more
in line with Qt version.
Change-Id: I71739a5d61c9980fc6da729dcb59b0900047f066
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
canFetchMore/fetchMore, and insertChild (at given position). Make
prepend/appendChild use the latter.
Change-Id: I4162fe6e64f37d26de209aa81894c9730957694b
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Full separation does not seem possible as QTreeView assumes
all items to have equal column count.
Change-Id: Ia260924fe13ea62789923af8484f9838295355b6
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
If the first descend did not hit the desired level the iterator
was backing one level too much and failed to visit some items.
Change-Id: Ia0f48a101a9daa0ad9359d081fe1949009ba6e19
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
... and use the items themselves as main entry point for
item related operations.
With non-uniform tree items it's easier to have item specific
functionality directly in the item implementation instead of
the model.
Change-Id: I4e9b7db98d16b91ddef81917417691129bb83621
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Add functions to remove a single item, to access the last child
of an item and a simple way to construct items that only display
static data.
Change-Id: I89347fbb6bbbac6b77fcfb23fa0b780a13643d6f
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This is mainly used to communicate the number of columns and
header contents.
Change-Id: Ic3163265338d71f1fa8250e4765bb764e5784197
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
That kind of boiler plate comes up often enough to justify a wrapper.
Change-Id: I94aa5b1ccbe5a98f091a47087654e59e9e122c1d
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>