Commit Graph

51 Commits

Author SHA1 Message Date
hjk
def8ca8ba1 TreeModel: Move some base TreeItem code out-of-line
Avoid code explosion.

Change-Id: I7d239a4560e90b68cc4991341adf940a98776254
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-08-03 09:23:46 +00:00
hjk
be2a0b9ecd TreeModel: Remove BaseTreeModel::topLevelItemCount()
Not used, and easily done with rootItem()->childCount() in case it
is needed again.

Change-Id: I7e85ac1bb72b3a799987b1bf6bd54d21b7ab06ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-08-03 07:54:35 +00:00
hjk
c3d3589c0f TreeModel: Remove now-unused TreeItem::setFlags() and m_flags
Change-Id: I1bae545b96c274a74cd6491b33ba138be489086f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-08-01 07:23:37 +00:00
hjk
53415cece1 Utils: Streamline TreeModel API
The LeveledTreeModel case is general enough to cover
the UniformTreeModel case, so merge them and rename to
TreeModel. The former TreeModel is now BaseTreeModel.

BaseTreeModels should not be instantiated directly,
a tree model with non-uniform basic items is available
as TreeModel<>.

Done-with: Eike Ziller <eike.ziller@qt.io>
Change-Id: I64a65617ab68c0cde39cf65f4bc092ef808ee6fb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-07-27 08:00:40 +00:00
hjk
e6069d8b03 TreeModel: Introduce a recursive TreeItem::updateAll() function
Useful in cases where e.g. siblings are affected (e.g. font
changes to indicate active items).

Change-Id: Ib2f8018688d00bd682bb6aaff08156f0be04f5dc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-07-12 12:02:03 +00:00
hjk
e48451b0a3 TreeModel: Consolidate child()/childAt() and rowCount()/childCount()
We never used the possibility to overload the virtual child() and
rowCount() functions, it's unlikely to be needed in future.

Change-Id: I7ebdf4dfc70bb0bcadea9ef3fb88f16632a95696
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-07-07 13:39:15 +00:00
hjk
7b4c7d49a9 TreeModel: Introduce a destroyItem() convenience function
Shorthand for delete takeItem(...).

Change-Id: Icb7b60e5c19aa0d21650eefff65f7eb55e9f90b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-07-06 11:41:55 +00:00
hjk
fb482846fc TreeModel: Add a StaticTreeItem(QString) convenience constructor
Covers the common case and hopefully avoids the recurring MSVC
problem with initializer lists in this location.

Change-Id: I1b2bbb083f9fc86af3b51b8f52615fb70c832b95
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-06-17 08:09:48 +00:00
hjk
b281d6dad7 TreeModel: Introduce a StaticTreeItem
This splits out the case of static string displays from the
TreeItem base class, making the base more lightweight.

Change-Id: If1f442011ec60094399a41b65d9b5015f432f82e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-06-15 08:55:16 +00:00
hjk
44771d245b Utils: Remove now unused type-unsafe TreeItem child iteration
Change-Id: I128b2230e58c5a84ff9c018978ff31fc02171771
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-06-13 07:38:32 +00:00
hjk
dee7ad3806 TreeModel: Rework tree iteration
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>
2016-05-12 12:30:36 +00:00
hjk
8390f9e80a TreeView: Announce sorting tree items
This is likely to be overkill but seems to fix a regression introduced
by e73a9c1b0d: Persistent model indices owned by the selection
model of the watch view lose their model pointer and consequently
cause error messages to be emitted and potentially cause crashes.

Change-Id: I3334ca25bb5e2facf51d03c50647f95f55786498
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-05-04 12:20:22 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
hjk
9f6cfe4803 TreeModel: Assert when inserting items that already have a model
Makes the assumption Item::m_model != 0 if and only if item belongs
to a model explicit.

Change-Id: Ib58889fd10e9fce1590a42ade6d847aee747ac56
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-11-10 14:55:53 +00:00
Christian Stenger
133af73b2a TreeModel: Ensure that proxy models or views get notified...
...when the root item is exchanged.

Change-Id: Ic854259902bcfdcf5ec5776ad40b56bca3820bf5
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-09-28 07:20:59 +00:00
hjk
4363e3e9e4 TreeModel: Remove TreeItem::setModel from interface
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>
2015-07-13 09:06:50 +00:00
hjk
8c583cb382 TreeModel: Add a few more soft asserts
This establishes an additional invariant, namely that items
that are not part of a model have m_model == 0, even if their
destruction is imminent.

Change-Id: I0bad7fff57d21ddcefe06953cd0da8c2897baa4a
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-06-23 11:01:33 +00:00
Eike Ziller
2cb3fe1429 TreeModel: API for setting header tool tips
Change-Id: Ieea98d244d689778db868604d981badcd166a7b5
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-06-11 15:54:08 +00:00
Eike Ziller
b1393d4778 TreeModel: takeItem should return the item
The usual Qt API for "takeXyz()" methods is to return the item that was
"taken".

Change-Id: Ie144051801487a301b3f13e2857735b65f58150b
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-06-10 08:05:32 +00:00
Christian Stenger
35680abd9e TreeModel: Inform view about changed root
This removes the need to emit the respective signal by the caller
of setRootItem() if the tree has been constructed before using
setRootItem().

Change-Id: I6f6210a9ef7d9ec3d347dc7cfdaf853535ca7656
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-06-04 06:24:39 +00:00
hjk
ad49b68605 TreeModel: Some extra checking
Change-Id: I75751c792b22998990ef453d51b9586fdaf31f50
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-23 13:35:15 +00:00
hjk
66fd805809 TreeModel: Clean up TreeItem API
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>
2015-04-22 14:08:15 +00:00
hjk
2b19081cb0 TreeModel: More API cleanup
- introduce topLevelItemCount (similar to QTreeWidget)
- squash untypedTreeLevelItems()
- rename removeItems() to clear()
- rename removeItem() to takeItem()
- rename treeLevelItems<> to itemsAtLevel<>

Change-Id: I0f1bb4110f7687b20da3d92e3d943858645a9fa2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-22 13:48:18 +00:00
hjk
89b0e4c069 TreeModel: API cleanup
- rename index{From->For}Item
- rename item{From->For}Index
- remove ununsed setColumnCount

Change-Id: I1cce9657e476dd1e8ffa9f7cdb2e646fab6884ab
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-22 12:08:37 +00:00
hjk
2d0cd79067 TreeModel: Ensure deterministic state during child destruction
This allows tree items to rely on not being part of a model
inside their destuctors.

Change-Id: I5f19739d3701426b068a07bf82f5199fbb259f29
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-04-22 09:59:26 +00:00
hjk
b3f88df41d Debugger: Remove most remaining occurrences of WatchData
... 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>
2015-03-20 08:36:57 +00:00
Eike Ziller
7450a09af3 Plugin view: Fix sorting
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>
2015-03-16 11:48:27 +00:00
Christian Stenger
7121315a71 Utils: Fix propagation of underlying tree model
Change-Id: I23739cb4c7a19a5c5bcdc8bf39c36db689292b62
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-23 11:52:56 +00:00
Eike Ziller
9926fc2ab1 Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'
Conflicts:
	src/libs/utils/tooltip/tipcontents.cpp
	src/libs/utils/tooltip/tipcontents.h
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/baremetal/baremetalconstants.h
	src/plugins/baremetal/baremetaldevice.cpp
	src/plugins/baremetal/baremetaldevice.h
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.h
	src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h
	src/plugins/baremetal/baremetalplugin.cpp
	src/plugins/baremetal/baremetalplugin.h
	src/plugins/baremetal/baremetalruncontrolfactory.cpp
	src/plugins/baremetal/baremetalruncontrolfactory.h
	src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
	src/plugins/cppeditor/cppdoxygen_test.cpp
	src/plugins/cppeditor/cppdoxygen_test.h
	src/plugins/debugger/breakpointmarker.cpp
	src/plugins/debugger/debuggeritemmodel.cpp
	src/plugins/debugger/debuggeritemmodel.h
	src/plugins/debugger/loadcoredialog.cpp
	src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
	src/plugins/projectexplorer/addnewmodel.cpp
	src/plugins/projectexplorer/addnewmodel.h
	src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.h
	src/plugins/qmlprofiler/notesmodel.cpp
	src/plugins/qmlprofiler/qml/CategoryLabel.qml
	src/plugins/qmlprofiler/qml/MainView.qml
	src/plugins/qmlprofiler/qml/Overview.js
	src/plugins/qmlprofiler/qml/Overview.qml
	src/plugins/qmlprofiler/qml/TimeDisplay.qml
	src/plugins/qmlprofiler/qml/TimeMarks.qml
	src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.h
	src/plugins/qmlprofiler/timelinemodelaggregator.cpp
	src/plugins/qmlprofiler/timelinemodelaggregator.h
	src/plugins/qmlprofiler/timelinerenderer.cpp
	src/plugins/qmlprofiler/timelinerenderer.h
	src/plugins/qmlprojectmanager/QmlProjectManager.json.in
	src/plugins/texteditor/findinfiles.cpp
	src/plugins/vcsbase/vcsconfigurationpage.cpp
	src/shared/qbs
	src/shared/scriptwrapper/interface_wrap_helpers.h
	src/shared/scriptwrapper/wrap_helpers.h
	tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp
	tests/system/suite_debugger/tst_debug_empty_main/test.py
	tests/system/suite_debugger/tst_qml_js_console/test.py
	tests/system/suite_debugger/tst_qml_locals/test.py

Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
2015-02-12 17:29:21 +01:00
Christian Stenger
d24fab71eb Utils: Avoid accessing null pointer...
...and make sure model is propagated when using copy constructor.

Change-Id: I95b95ebb7f6058adc73bc6e73b4f23a87012a2b2
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-02-09 14:04:06 +00:00
hjk
bca7015ce8 TreeModel: More sanity checks
Change-Id: I5f452c94ba4970cadda7840b8a5bcbe8871d84ac
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-02-09 11:30:35 +00:00
hjk
a4b2801fed TreeModel: Make TreeModelVisitor useful
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>
2015-02-09 07:22:17 +00:00
hjk
a6e9f032e3 Debugger: Use Utils::TreeModel for watch window
The circle closes, that's where the code came from.

Change-Id: Ic36ab61ec8886c9a2747aeb29a7245df3ef0b6c4
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-29 10:32:32 +00:00
hjk
999a11a745 TreeModel: Fix model back pointer propagation when adding items
Only the top level entry was handled so far, but we might add
items with subitems.

Change-Id: I55084a1f595f4982bd37168e71b144b17eee63b1
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-01-28 16:09:50 +00:00
hjk
706c826bc1 TreeModel: Make item flags configurable in "group header" constructor
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>
2015-01-28 16:09:38 +00:00
hjk
31fecb0820 TreeModel: Add more item functions
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>
2015-01-26 22:09:11 +01:00
hjk
ec187241e5 TreeModel: (Partially) separate header data from root item
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>
2015-01-21 08:42:52 +01:00
Eike Ziller
3c85058694 Update License
Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-16 12:37:56 +01:00
hjk
7e522c8a37 TreeModel: Add model pointer to TreeItem
... 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>
2015-01-15 16:06:38 +01:00
hjk
036f4f00eb TreeModel: Add a TreeItem::setData function
Change-Id: Id59c35068cd5a2ba22ccfddd45a0826dd68e9905
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-13 16:14:07 +01:00
hjk
2f17b74753 Debugger: Take advantage of new tree iterator in option page
Change-Id: I1a8e065cfaa57b49c852a3a1d67149447d4d87b2
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-12 13:18:24 +01:00
hjk
6ebdc18f98 TreeModel: Simplify indexFromItem()
Change-Id: Ief7f120ef27eb43746826da7c771b5f9a3f7ce8f
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-12 10:29:42 +01:00
hjk
39c7472862 TreeModel: Add good old ModelTest's code
Currently #if'd out, but takes only a one line change to enable
quick testing. Tests pass with the included change to flags().

Change-Id: I6dca376f162ad26e8ce6de65241e56497ff7267e
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-12 08:49:05 +01:00
hjk
3d0537fa8a TreeModel: Add function to remove all children of an item
Just convenience.

Change-Id: Ieff2291ca63584cfa113a24cc2930adc3e764d08
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-01-09 16:52:24 +01:00
hjk
82c2f51a29 TreeModel: Make debug help code less intrusive
Has not been needed for a while.

Change-Id: I141725d77343c4afa9907fde6af8e283f2744c88
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-09 13:49:00 +01:00
hjk
94b8a21fbf Utils: Add TreeModel iteration facility
Change-Id: Iaf115377de0e5fc0b004d5ea8ddc5c6eb31b5b6f
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-09 13:48:03 +01:00
hjk
115acfe127 TreeModel: Add some convenience functions
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>
2015-01-05 08:57:38 +01:00
hjk
a8ece5e9b0 TreeModel: Make root item configurable
This is mainly used to communicate the number of columns and
header contents.

Change-Id: Ic3163265338d71f1fa8250e4765bb764e5784197
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2014-12-17 14:18:01 +01:00
hjk
e30e34f464 TreeModel: Rows are not columns.
Change-Id: I33a6d017f14ee9703b374f645c279cc26e3cb3e5
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-10-17 16:45:21 +02:00
Eike Ziller
9c7019f0b2 License update.
Change-Id: I0acde2c3b995693de682679471f03af85bdd0a61
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-10-15 15:19:55 +02:00