Commit Graph

217 Commits

Author SHA1 Message Date
hjk
2c40765e86 Core: Add a static IContext::attach() function
... to simplify the user code.

Some, but not all, potential beneficiaries are adapted.

Change-Id: Ia7d514a0114a4f99f8ee745523435f5b990bd095
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-07-04 10:09:53 +00:00
hjk
efae651924 Utils: Introduce a convenience function creatorColor()
... forwarding to creatorTheme()->color(...)

Change-Id: Iefaa043495127b3e500ed225584481d3ec0f8c1f
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-05-29 13:49:25 +00:00
Cristian Adam
1fb5b54221 PE: Fix ProjectTreeWidget::expandedCount not to use 0 for error cases
This would make ProjectTreeWidget::nodeForFile pick the wrong node due
to nodeExpandCount having a lower count.

In case of qml files there is the source file node and the resource file
node pointing to the same file name, but the resource name has an invalid
index (not visible in the project view) and shouldn't be preffered!

Fixes: QTCREATORBUG-30571
Change-Id: I2aff7da9dd6d83222e341b5cbcb78db5cd6a9224
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-05-08 15:16:15 +00:00
hjk
941ebc84e9 ProjectExplorer: Use new setup pattern for ProjectTreeWidgetFactory
Change-Id: Id046dca1358547e21a2920eac62f5a694c7f6905
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-01-10 06:39:42 +00:00
Tim Jenssen
9f1d23df00 Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Ic852bc9977d0292fb6cd93a319f4bfdebb22a1b0
2023-11-16 17:17:46 +01:00
Burak Hancerli
d92043e69c ProjectExplorer: Overlay the original icon for missing files
QmlProject could be edited manually to add files into the project.
In case of the files are mising in the file system (or if there's
a typo in the file path) file names still shown in the project
explorer without any information. This patch brings a small overlay
on top of the original icon to notify the users that the file doesn't
exist.

Task-number: QDS-10344
Change-Id: Ia73699b048725bcc70a1ee0f52c34b55b081a779
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
2023-11-06 19:54:17 +00:00
Eike Ziller
0089d3cc3d ProjectTreeWidget: Remove unused event filter
The object that is installed as an event filter doesn't implement
eventFilter.

Change-Id: Icc51346e0c9eadf7448a4889df4c447d3bc3082c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-10-25 09:32:09 +00:00
Eike Ziller
91975f98af Merge remote-tracking branch 'origin/master' into 12.0
Change-Id: I0e2c7f8afb1c036814414160934f9ca1ac22bba7
2023-09-29 08:03:51 +02:00
Christian Stenger
51fbe96728 SquishTests: Fix accessing navigation tree view
Change-Id: I0f392c39c75c553cc65ade4c1689cf1085f1c5a1
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-09-28 12:29:51 +00:00
hjk
0eacd0190d All: Remove some unneeded #includes
Change-Id: If9a8fb5e0b32424e3b37ecf3adefc060f86b3630
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-09-27 13:50:38 +00:00
hjk
41184bc9fc Utils: Use numberedKey(Key, int) more wildly
Will ease transition to a key class that doen's have ::number()

Change-Id: Ib2f2957c916f41b0731a2033422bfbf7e429bcc8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 09:57:23 +00:00
hjk
c7710acadd Utils: Use Key more widely in QtcSettings
And adapt user code.

Change-Id: I6efe4ebe6823de4cc862f304a57e041b02c40eac
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 07:38:02 +00:00
hjk
7fccf02be7 Core: Use QtcSettings in NavigationWidgetFactory::restoreSettings()
Symmetric to saveSettings() now, and allows for central Key conversions
later.

Change-Id: I3fbf81c51197c9882b1f64ef591398b83aa0d633
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 06:56:30 +00:00
hjk
6c2864bd4b ProjectExplorer: And more Key and Store
Change-Id: Id5787890bdb46bfeef8e3f37923e6dc26cb56c31
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-24 11:20:25 +00:00
Alessandro Portale
5975657e77 Utils: Centralize style-related property names as constants
This introduces string constants in Utils::StyleHelper. They are used by
code all over in Qt Creator to tell ManhattanStyle how to paint certain
widgets.

Change-Id: Iecca36103f80084cd5fe93fcb6b18b8fbb3a32bb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-10 13:25:10 +00:00
hjk
3e7d93c788 ProjectExplorer: Move some not-fully-session related bits
... out of SessionManager.

The idea is to later move SessionManager into the Core plugin,
which both is sensible conceptually and also prerequisite to
merge the Bookmark plugin into TextEditor plugin.

Currently, only the interface is split, as the load/save
implemetations are non-mechanical to disentangle.

Change-Id: I31631db3094ea192825a2ccaa6add6188662940b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-01 09:26:50 +00:00
hjk
c5f7f5ab0a ProjectExplorer: Tr::tr
Change-Id: I8f1b463c5cc7a53627f7a9ad261998b92f13e56a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-16 12:10:24 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Jarek Kobus
5b3927869c Drop Qt5: ProjectExplorer: Get rid of QOverload
Change-Id: Id8b28efa7b31a92a5e24485803322c586a23802d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-20 13:13:11 +00:00
hjk
2496ffe3ce Code cosmetics
Mostly unused #include's, also sort them or reduce scope.

A few namespaces, ...

Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-24 14:44:13 +00:00
Artem Sokolovskii
51be3be2ea ProjectExplorer: Remove foreach / Q_FOREACH usage part 2
Task-number: QTCREATORBUG-27464
Change-Id: Ibfacf5a3b9789a3cf0ea229d1b0d22639101bf9a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-12 11:12:03 +00:00
Eike Ziller
2fab827782 Support external editors for locator, projects and file system tree
When setting an external editor as the default editor in the MIME type
settings.

Other operations like File > Open, or when using navigation shortcuts
like Follow Symbol, and stepping with the debugger will still always
open the file within Qt Creator. The Open with... menu can still be used
to explicitly open a file in an external editor afterwards.

One of the use cases is to be able to open some files that would
otherwise unhelpfully be opened in Qt Creator's binary editor in the
systems default editor.

Fixes: QTCREATORBUG-13880
Change-Id: I852f097da8badd10de78b74e7078987447eebe98
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-25 12:35:55 +00:00
Henning Gruendl
a09ec2e0e9 QmlDesigner: Fix project tree widget renaming
When renaming an item in the project tree widget which has concatenated
filename extensions like *.ui.qml the selection in the LineEdit will
reach till the last dot.

* Extend FilePath suffix and completeBaseName function so they will
  treat the suffix *.ui.qml as one
* Make use of the function in ProjectTreeWidget::editCurrentItem
* Replace QFileInfo::suffix with Utils::FilePath::suffix in
  FlatModel::setData

Task-number: QDS-2713
Change-Id: I30d0e6d87a7512d42fd3d40b2282b94e79b43684
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-09-08 06:47:51 +00:00
Wojciech Smigaj
3af9590db2 Rename "Show Source and Header Groups"
This patch renames the "Show Source and Header Groups" filter to "Hide
Source and Header Groups" for consistency with existing filters such as
"Hide Generated Files".

Change-Id: I34c204f7cae55bab60a50932cf307614987ef2ea
Reviewed-by: hjk <hjk@qt.io>
2021-07-16 19:53:38 +00:00
Wojciech Smigaj
194569b471 ProjectTree: Add an option to hide Source and Headers file groups
A new checkbox "Show Source and Header Groups" is added to
the filter menu in the project tree. It is checked by default.

Unchecking it removes the extra level of virtual folders containing
sources and headers.

Change-Id: I25f4514e7f1f6cdfcb531a911e54cc6e7e42a3e2
Fixes: QTCREATORBUG-25313
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-24 05:24:26 +00:00
hjk
76db1e3746 Core: Add FilePath based overloads to EditorManager::openEditor{,at}
Part of the overall FilePath migration. Keep the original version for
a while to allow using code to catch up.

Change-Id: Ia7c5ea14416a06e679e8661c0e4045981db87b9b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 09:55:50 +00:00
hjk
11f574fef9 Core: Unify INavigationWidget creation a bit
Move toolbutton creation/listing closer to the widget.

Change-Id: I0e1342ede40fada1c5c9fb0b11d77852b78cc053
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-18 08:35:28 +00:00
Eike Ziller
16d25a3cc8 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/qmldesigner/assetexporterplugin/componentexporter.cpp

Change-Id: If742bcd843cf75cf55e07b489ecb7211f0cd9058
2021-01-18 11:50:32 +01:00
Eike Ziller
b83c829e21 Fix project tree's "synchronize with editor"
When for example closing all editors, the selection in the project tree
is removed, but after re-opening the previously selected file, the
selection was still missing.

Qt item views differentiate between "current" item and "selection". The
code uses the "current" item for tracking, but when clearing the
selection in the project tree, the code did not "clear" the "current"
item.

Change-Id: I182c7b78bf8dcc51af71e860ac620310d472b7b5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-12 14:43:53 +00:00
Eike Ziller
d204065660 Fix that file from project is selected in file system node
The new file system node in CMake projects leads to funny selections in
the project tree when "Synchronize with Editor" is turned on.
Since the file system items are less deep in the tree than the files in
the "regular" CMake project tree, they were selected instead of the
regular project nodes.

Reduce the selection priority for the nodes in the file system sub-tree.
For this remove the hard-coded priorities when selecting nodes for
"Synchronize with Editor" and use the existing node priorities.

Amends 53115259ba

Fixes: QTCREATORBUG-25208
Change-Id: I69c08c4f0e7afa305141a0c475af515d9db1363b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-01-12 14:43:26 +00:00
Eike Ziller
a052f1f715 ProjectTreeWidget: Use constants and get rid of QLatin1
Change-Id: Iaf155cf01ab502d411b0b5467abe4eff65c798ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-12-16 16:22:20 +00:00
Eike Ziller
c898047880 ProjectExplorer: Don't save defaults to settings
Writes less settings and makes it possible to change defaults in the
future.

Task-number: QTCREATORBUG-24762
Change-Id: I73873b3684827b4fe27cfa5ea2f62a76003f9750
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-12-16 08:40:24 +00:00
Eike Ziller
e5bb7d1ffe Remove unnecessary removeContextObject calls
They are removed on deletion now.

Change-Id: I08461ea4938e24ab450df013a0f8f820032381da
Reviewed-by: hjk <hjk@qt.io>
2020-05-27 08:42:00 +00:00
Christian Kandeler
5451b78367 Project Tree: Add functionality to expand a single node recursively
From time to time, I find myself wanting to fully expand
a specific sub-tree.

Change-Id: Ie49b76a7a7a6fae3684bbdfb5735638bbc41b301
Reviewed-by: hjk <hjk@qt.io>
2020-02-20 09:56:31 +00:00
Orgad Shaneh
0737291d54 Merge remote-tracking branch 'origin/4.11'
Change-Id: I65ce6aa917219a8f8b91b48c7077f8097248375c
2020-02-06 12:50:22 +02:00
Orgad Shaneh
d2dff64cba ProjectExplorer: Fix endless waiting when switching to Git editors
Show, Diff etc.

Change-Id: Ibdd6e61c72a9a8fd797a02d15dae7b8be08b405c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-02-05 10:35:09 +00:00
Christian Kandeler
2c295905a9 Fix various leaks relating to use of Core::NavigationView
Change-Id: I8ba508b279376047bcf7ae17dbdadba70ec13582
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-27 09:12:52 +00:00
Christian Kandeler
20a5aa889f Revert "ProjectTree: Add per-node "Expand" and "Collapse" actions"
This reverts commit a5785e678e.
These actions are already available from the standard tree view UI...

Change-Id: If8dfe755ee450a89588ec944ae6ff7601250cdde
Reviewed-by: hjk <hjk@qt.io>
2019-12-20 13:09:19 +00:00
Christian Kandeler
a5785e678e ProjectTree: Add per-node "Expand" and "Collapse" actions
Change-Id: Ic722598f7bb2665ac7a09c24b7eefa9dc6787808
Reviewed-by: hjk <hjk@qt.io>
2019-12-20 09:37:57 +00:00
Eike Ziller
04bd6e39c8 Merge remote-tracking branch 'origin/4.11'
Conflicts:
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp

Change-Id: I8ea57eba526ab830608fd928c28771c5441749f8
2019-11-01 15:31:19 +01:00
Nikolai Kosjar
6c1b11dd3e ProjectExplorer: Simplify
bugprone-branch-clone
readability-simplify-boolean-expr

Change-Id: Iaaac21e96a3e9db6b9819d77fdae623ede373e59
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-01 09:31:32 +00:00
Christian Kandeler
b8657ac739 Project Tree: Allow to hide disabled files
Project manager plugins can mark files as disabled, typically meaning
they are not part of the project in the current build configuration.
Let's allow users to hide such files altogether.

Fixes: QTCREATORBUG-22821
Change-Id: Ie92d523d1f895bee8076de1d7eea1d7a739fe11f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-10-22 13:42:03 +00:00
Christian Kandeler
087396fe00 ProjectExplorer: Support bulk renamings in project tree
If a user changes the name of a file abc.cpp to def.cpp, and there is a
file abc.h in the same directory, it's likely that the user wants to
rename that file to def.h. Detect such circumstances and offer the user
to automatically rename the sibling files.

Fixes: QTCREATORBUG-21738
Change-Id: Ib3ece08698a3341ef4087066d2289048f6b0fa61
Reviewed-by: hjk <hjk@qt.io>
2019-08-16 12:28:23 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
Eike Ziller
39477594da Merge remote-tracking branch 'gerrit/4.9' into 4.10
Change-Id: I033d6baa40af45ae1eb6ed82827ff51213c832f5
2019-06-13 13:53:02 +02:00
Tobias Hunger
f3ea8e34de ProjectTree: Save state of "Hide Empty Directories" filter
Change-Id: Iafd7248242e95dc0d5205649747f46d98e05873d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-13 11:48:49 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
a5148b5363 ProjectExplorer: Rename ProjectTree::findCurrentNode to currentNode
For consistency, it's straight forwards access, similar to
currentProject, not much to search and find.

Change-Id: I7ce696bdc24b6a8713d6f11e02443a6f94c605f6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-30 17:10:39 +00:00