Commit Graph

370 Commits

Author SHA1 Message Date
Marcus Tillmanns
129448d61d QmlJS: Fix Follow under cursor
When trying to jump to a symbol in a qml file the Qml Model may find
the location in a generated .qml file in the build folder.
QtCreator searches in all generated .qrc files to try and find
the source file so it can jump to it instead.

Previously not all auto-generated ".rcc" folders would be found
as only the folders of targets (executables) were searched.
Plugins or Static Libraries were not searched.

With this fix, all projects nodes are searched for the ".rcc" folder
and therefore also finds them for Dynamic / Static libraries and
plugins.

Fixes: QTCREATORBUG-27173
Change-Id: Ic51ac8fbc82c15785cbefd76787942a512ecf3db
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-08 09:54:10 +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
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
hjk
f974488128 ProjectExplorer: Move makeInstallCommand()
... from Project to BuildSystem.

More direct and less use of Target::activeBuildConfiguration().

Change-Id: I148381d23be0f9ab0750ed1440e1b2b3e25aded0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-13 10:22:40 +00:00
hjk
e2e5d67bc3 ProjectExplorer: Use FilePath in installRoot machinery
Helps to get path delimiters right.

Change-Id: Ifaab593a530c667488b7b5e6546041d8c212ece8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-10 14:03:09 +00:00
hjk
eb886ad40b ProjectExplorer: Use CommandLine in MakeInstallCommand
Instead a FilePath/QStringList pair.

Change-Id: I55340795266699e448ec1e17681a5e788eaae37a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-10 14:02:50 +00:00
Christian Kandeler
21c215f83c ProjectExplorer: Make BuildSystem:Name variable available
... for use in the default build dir template.

Task-number: QTCREATORBUG-26147
Change-Id: I1a32d60e0d5e2db514ac315c48c615c55ccda51f
Reviewed-by: hjk <hjk@qt.io>
2022-06-03 13:20:08 +00:00
Thomas Hartmann
454682ea3f Do not enter edit mode when opening a .qmlproject as QDS
If the user opens a .qmlproject in QDS mode we do not want to
enter the edit mode by default.
We check the startup project after opening and calling
openEditMode() will determine if we keep the default of opening
the edit mode or not.

Change-Id: Ic8a7fbefa007d487ec680099544c07fe007c0b29
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-07 15:17:54 +00:00
Christian Kandeler
15639d00ed ProjectExplorer: Prevent cascading "Replacement for" kit names
Fixes: QTCREATORBUG-26330
Change-Id: Id7abd00afb70fe2d2e3c1a43e2ea1298c0ff20cc
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-20 13:02:36 +00:00
Jarek Kobus
2948d282ce Don't call DocumentManager::addDocument() from non-main thread
Detect that constructor of ResourceTopLevelNode is being
run from non-main thread and omit creation of ResourceFileWatcher
in this case. The construction of ResourceFileWatcher
will be postponed until the node tree returns back
to the main thread. This happens later inside
Project::setRootProjectNode() when ProjectTree::applyTreeManager()
is called for the second time - this time it's done from the main
thread. In order to setup the lacking resource file watchers
we install an additional folder node visitor only in case when
the handler is called from main thread. The visitor
sets up the lacking resource watchers if that's still needed.

Amends: 0bcab32657

Fixes: QTCREATORBUG-26417
Change-Id: Ia1bfb7f284afb833b6b4291accc4d0a91bd0d6c5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-20 12:35:22 +00:00
Eike Ziller
57b5cd69b9 Fix build with C++20
"erase" without namespace conflicts with std::erase, with the latter
taking precedence.

Amends 9929d3dd73

Fixes: QTCREATORBUG-26386
Change-Id: I7fa64827ad61f1da262ce48082854975bc431c69
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-10-19 13:02:03 +00:00
Christian Kandeler
939cc5af21 ProjectExplorer: Give build systems a name
... and make it accessible through a variable.

Fixes: QTCREATORBUG-26147
Change-Id: I0601c09a74360b91fe8421876207a8f4ae9d75b6
Reviewed-by: hjk <hjk@qt.io>
2021-09-09 14:41:56 +00:00
David Schulz
d5e0567f78 ProjectExplorer: prevent using QFileInfo on remote paths
Change-Id: Icf5dc9a80af69e8e1c3d733847e227486fa8c897
Reviewed-by: hjk <hjk@qt.io>
2021-09-09 09:47:41 +00:00
hjk
9929d3dd73 ProjectExplorer: De-noise project.cpp
Namespaces, some inlining.

Change-Id: Ib6e8e0440e69492c1f486ae0358d8d59bafbfefb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-26 13:17:29 +00:00
hjk
22ecef0444 ProjectExplorer: Streamline access to buildDirectoryTemplate data
There's only one kind of use, in the context of BuildConfiguration.

Change-Id: I09628ff443ef08e28738125a614c17d5d979189b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-24 16:27:33 +00:00
hjk
8885ef7e5a Utils: Pass dialog parent to Utils::* file dialog
Amends 3edc5673b5.

Turns out quite a few potential uses have other parents than
ICore::dialogParent().

Use a nullptr parent to mean ICore::dialogParent() to keep the
caller side simple.

Change-Id: Icfe1daafd710ae273d286679e0c8e2a3a27da552
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 12:54:08 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
hjk
b8f369c436 Use the new file dialog wrappers in some places
Change-Id: I326c883f2f76593e6fcb0f3e376d387273312982
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 08:56:51 +00:00
hjk
9b250ea2c0 ProjectExplorer: Use FilePath in ProjectExplorer::openProject{,s}()
Change-Id: Ibfb7ab5ef7226b85452bd37b840408708935453b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-27 11:35:47 +00:00
Eike Ziller
426f8185c2 ProjectTree: Improve performance of finding nodes
Using projectNode->forEachGenericNode(...) to find a node is much slower
than using project->nodeForFilePath(...), since the latter uses a binary
search.

Fixes: QTCREATORBUG-25845
Change-Id: I91be577a11b03915d1f21fe86a4cdd9ab0381f51
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-14 13:43:23 +00:00
Cristian Adam
8ed5836746 Project: Remove knowsAllBuildExecutables feature
This is feature is no longer needed.

Change-Id: Ia0798402fcb4c06fb4dd38225359738306211176
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Reviewed-by: hjk <hjk@qt.io>
2021-07-01 15:49:01 +00:00
Eike Ziller
b29ee5493b Avoid registering individual files for watching
if we can do it en bloc. This reduces the freeze happening after loading
a project, at least on macOS with QFSEventsFileSystemWatcher, which
doesn't like getting 1000 files added one by one.

Task-number: QTCREATORBUG-25783
Change-Id: I2d508ac3334520cb8805a2179d42b86c9ba840d6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-11 14:48:00 +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
Eike Ziller
bf5b1d714c Revert "Revert "Merge remote-tracking branch 'origin/4.15'""
This reverts commit f0a86d4510.

Reverting a merge doesn't "undo" it - the changes would be lost
forever even with subsequent merges.
So we need to revert the revert to get the changes.

Change-Id: I65928f876f4dc886561bed17c4b2aa42b388c1e3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2021-05-07 09:07:40 +00:00
Marco Bubke
f0a86d4510 Revert "Merge remote-tracking branch 'origin/4.15'"
This reverts commit 888ca0dd20.

Reason for revert: wrong patchset

Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-05-06 15:30:02 +00:00
Tim Jenssen
888ca0dd20 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/libs/sqlite/sqlitebasestatement.h
	src/plugins/qmldesigner/qmldesignerplugin.cpp

Change-Id: I0fa0a8a7feffed24c0d2bc26eca86590f1156755
2021-05-06 13:07:48 +02:00
Christian Kandeler
201786d3fc ProjectExplorer: Prevent target switch on project that's to be removed
Switching targets starts up a lot of machinery that is undesired for a
project that's going away.
The same goes for switching build configurations on a target that is
being removed.

Fixes: QTCREATORBUG-25655
Change-Id: I0cb6e395cca8f89bfeb70fcdf571bbcb64f94247
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-06 10:08:24 +00:00
Tapani Mattila
d5cadcfa59 ProjectExplorer: Enable to easily check if a project has dirty files
Task-number: QDS-4241
Change-Id: I2fec5f411cdff9fabfa31bbd73971c0308df0783
Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-05 11:07:40 +00:00
Christian Kandeler
413b83ddf9 QmakeProjectManager: Fix possible crash on project document reload
... while a parse is going on.

Fixes: QTCREATORBUG-25137
Change-Id: I02a914332ef120caee044139581e1901b4537bff
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-13 08:04:56 +00:00
Orgad Shaneh
3122a1bfc5 Aspects: Remove some more default values
Change-Id: Iadee8b8f1eeb3ff009a667d45a51f6f5a94329ca
Reviewed-by: hjk <hjk@qt.io>
2020-11-10 08:06:51 +00:00
Leena Miettinen
f2254419af Project explorer: Fix UI text
Fix punctuation.

Task-number: QTCREATORBUG-24873
Change-Id: I5cc5e80915b891efa2cd2268e3302feb39b7a576
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-09 09:52:12 +00:00
Fawzi Mohamed
f26b7a3700 projectexplorer: avoid crash if recovery of kit fails
Change-Id: I8bf3a24b1485da2bfd1eb13e61c2712b66b30a70
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-09-29 21:41:22 +00:00
Christian Kandeler
4c1c11b7b6 QmakeProjectManager: Fix crash on reparsing
After a re-parse, the existing IDocuments need to be updated with the
new QmakePriFile object, as the old one may no longer be valid and thus
cause a crash on the next re-parse.
Amends f3bd07efd1.

Fixes: QTCREATORBUG-24683
Change-Id: Ib03d3005cb7831f1e05cb116aa3cdfe6cf5e72ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-28 11:29:41 +00:00
Christian Kandeler
781a4484a1 ProjectExplorer: Remove replacement kits
... for which the original kit has turned up again. Otherwise we'd have
more than one kit with the same id.

Fixes: QTCREATORBUG-24589
Change-Id: I7ce16615694d3d2c5a5441f676ecb7dc85c2239c
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-21 11:57:03 +00:00
Christian Kandeler
f3bd07efd1 QmakeProjectManager: Restore incremental re-parsing
This was broken in commit 37aecdd112, where we overlooked that a special
type of IDocument was used that triggers a re-parse of only the affected
part of the project tree. As a result, all changes to a .pri or .pro file
would trigger a re-parse of the entire project.

Fixes: QTCREATORBUG-24572
Change-Id: I480cff4e53cf86a17e1eaac0eb9b32901bc87051
Reviewed-by: hjk <hjk@qt.io>
2020-09-15 09:19:23 +00:00
Tim Jenssen
4fe5b923cd Merge remote-tracking branch 'origin/qds-1.59' into 4.13
Change-Id: Ic720f3adab305c5ef8cd10e713ccabf510eff0c0
2020-08-13 06:39:40 +00:00
Tim Jenssen
e95a95cdfe projectexplorer: add availableQmlPreviewTranslations()
Preparation for a test translations feature.

Change-Id: I1a7ccecab803f5838cd765b7dca99bcf5bb9e8a1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-07-15 21:37:50 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
Christian Stenger
6e798401a0 Fix plugin unit tests when using projects
The ClangTools and the AutoTest plugins use an internal
mechanism to load and configure a project when performing
their integrated unit tests.
Both assumed to have exactly one kit present for these
tests.
Make it possible to have more kits present when starting
with existing settings or if more kits get automatically
generated when starting with clean settings.

Change-Id: If2bc66320c4854f1d34a19d17107e8f0b7d64d39
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-06-17 04:13:30 +00:00
Eike Ziller
5b364de168 Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
2020-06-02 11:44:53 +00:00
Christian Kandeler
4657563e4a ProjectExplorer: Try harder not to lose custom project settings
... when a kit disappears.
This can easily happen, for instance due to a Qt version update via the
installer, and until now resulted in the disappearance of all user
customizations of build and run configurations.
We now store some additional data when serializing a target, and use it
to recreate a kit of the same type upon restoring. While the resulting
configurations are not guaranteed to be functional, they should contain
all the customizations, which the user can then copy over to a proper
kit.

Fixes: QTCREATORBUG-23023
Change-Id: I659d52808b2f8a308e6aa094e8ef2ee60d586952
Reviewed-by: hjk <hjk@qt.io>
2020-03-19 14:28:40 +00:00
Christian Kandeler
ae0d2bd1ac QmakeProjectManager: Try harder not to access nodes of in-parse project
For extra safety, do not touch the project nodes if any build system of
any build configuration is currently parsing.
This is a bit of a stab in the dark, as I cannot reproduce the crash
described in the linked bug report.

Task-number: QTCREATORBUG-23597
Change-Id: Ie62a94232e89d8fba5866ea3572535e2ab209924
Reviewed-by: hjk <hjk@qt.io>
2020-03-05 12:40:47 +00:00
hjk
b0b50257ec ProjectExplorer: Pass extra project files as QSet
They are available in some cases as such, and consumed as such.

Change-Id: I9866c7d7bd817fb19a8b11a0efbe583ed55fe393
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-03 09:17:20 +00:00
Christian Kandeler
757628bf4a ProjectExplorer: Fix Project::setExtraProjectFiles()
This function was buggy and could erroneously un-watch all the project
files after the first update.

Change-Id: I528fd8da7f873598e08f4c0177757a052fbb97ef
Reviewed-by: hjk <hjk@qt.io>
2020-03-02 16:40:34 +00:00
hjk
6164378372 ProjectExplorer: Replace a few foreach()
Change-Id: I445cdfaac13ac894be3cd6fc8c20b4a09f460a01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-02 11:54:00 +00:00
hjk
8a8c49eb2e ProjectExplorer: Simplify update logic after active target change
Change-Id: Ia1d9366b1f2ff2b7ae02604bc43b38ca4b914c17
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-02 10:07:33 +00:00
hjk
3c436d0e42 ProjectExplorer: Introduce BuildSystem::parsingStarted/Finished
Some listeners are only interested in a particular build system
instance, not all of one target.

Change-Id: Id89bd96c1f7f68bac13886bdc31cb899978d76ac
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-12 16:59:29 +00:00
Tobias Hunger
e4738904d9 TargetSetupPage: Improve reporting on invalid kits
Give the reason for a kit being disabled in the tooltip.

E.g. for a CMake project you will now get

"Kit is invalid: No CMake tool set."

instead of a generic error message about the kit being invalid.

Change-Id: Ic776dc24149d65ebf27163b605ec2e52a3a504a7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-06 13:50:57 +00:00
Christian Kandeler
38cd7b1aa0 ProjectExplorer: Use different build dir when copying build config
...into another target.
Using the same build directory in two different targets will likely lead
to errors.

Fixes: QTCREATORBUG-23462
Change-Id: I7daa510b3128a344adb51772d44a79415419acc3
Reviewed-by: hjk <hjk@qt.io>
2020-01-16 13:32:52 +00:00