Commit Graph

90 Commits

Author SHA1 Message Date
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
6cd4d682b3 Debugger: Make the BreakHandler a LeveledTreeModel
Change-Id: Idcf61d63318b8a1ab768b298f1b789de13ed91b2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-06-13 06:55:01 +00:00
hjk
e2ba0aca9b Utils: Introduce a class template TypedTreeItem
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>
2016-06-10 06:56:55 +00:00
hjk
57042da683 Utils: Introduce a UniformTreeModel::itemForIndex function
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>
2016-06-09 13:37:59 +00:00
hjk
7a80f2f01e TreeModel: Take responsibility for some of the casting
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>
2016-05-30 06:25:48 +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
Eike Ziller
0f94aa3f4d Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/projectwizardpage.cpp
	src/plugins/projectexplorer/xcodebuildparser.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp
	src/tools/clangbackend/ipcsource/translationunits.cpp

Change-Id: Ibf0857cf8dbf95fc9ac13d5c2112b3f4a2ca7de6
2016-05-03 11:49:01 +02:00
hjk
ad1fb8d0bd TreeModel: Add override where appropriate
Change-Id: Ifdfcc1dffef91cd59332bee14cf6149c379376d4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-05-02 09:06:13 +00:00
hjk
39a38d5679 Wholesale conversion to #pragma once
Kudos to cgmb and https://github.com/cgmb/guardonce

Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-30 15:20:19 +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
Christian Stenger
752f4f459c Utils: Add default parameter to index()
Change-Id: I230a41a10026a80acba7497d72acc3a542565f6e
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-09-10 06:47:43 +00:00
hjk
db6126b82d Utils: Remove unused TreeItem::m_populated
Left over from the original implementation used for the VariableChooser.

Change-Id: I164cb306815823c988b6d79966f007298f6d1e59
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
2015-07-17 13:04:41 +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
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
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
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
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
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
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
hjk
0f0f7f1d3f TreeModel: Fix tree level item iteration
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>
2015-01-16 13:16:56 +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
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
f41e2ca7f6 TreeItem: Add accessor to static child list
Change-Id: I6683b19768d7cb9b492215c5a89b2cbbad67ff6d
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-01-07 08:54:24 +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
Eike Ziller
9c7019f0b2 License update.
Change-Id: I0acde2c3b995693de682679471f03af85bdd0a61
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-10-15 15:19:55 +02:00
hjk
88e4daa82b Utils: Add a base for tree like models
That kind of boiler plate comes up often enough to justify a wrapper.

Change-Id: I94aa5b1ccbe5a98f091a47087654e59e9e122c1d
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2014-10-14 18:24:08 +02:00