Commit Graph

382 Commits

Author SHA1 Message Date
hjk
83720540a1 CppEditor: Convert parts of ModelManagerInterface to FilePath
Change-Id: If7503b6d6732e1735eb8d48ece6e80886d10c647
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-29 12:27:10 +00:00
hjk
038771051d CppEditor: Switch to FilePath in IndexItem
... and fix fallout.

Change-Id: I45d27146806bdcb5ceb728b710eca51c7cd32ee2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-25 11:16:38 +00:00
hjk
fa1adf4d40 CPlusPlus: Proliferate FilePath use
The starts with CppDocument::filePath(), plus a bit of the fallout

This is one patch of potentially many. It is hard to draw the
line where to stop this kind of chunk, this here converts a few
additional functions for which including it in the patch looked
like less churn than without.

Converting is mostly fromString/toString, with a few exceptions
for "already seem" like caches, that use cheaper "path()" to
avoid likely performance regressions (on Windows FilePath
comparison is currently case-insenstive, and more expensive).

There should be no difference for local operation with this patch.

Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-22 15:30:00 +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
Jarek Kobus
cd582faa7e CppEditor: Limit the usage of qMakePair and std::make_pair
Change-Id: I4c85edbaccb553320b5488d3dd2c2595fc2bd825
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-04 14:06:00 +00:00
Christian Kandeler
0f7a539262 CppEditor: Let user decide whether to use "auto"
... in "Assign to Local Variable" quickfix.

Fixes: QTCREATORBUG-28099
Change-Id: I3640ef3d1e069bb2cac4d78f0ae60726b131c4fe
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-22 13:26:20 +00:00
Christian Kandeler
4119181762 CppEditor: Make value vs const ref return type configurable
... in the quickfix settings.
Also change the default: With mandatory RVO and move semantics, value
return types are the right choice most of the time.

Fixes: QTCREATORBUG-25790
Change-Id: I68fc6c616358478ba893101b3e04aa6bbbe79348
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2022-09-19 12:30:47 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Alessandro Portale
912b016ab0 Utils: Add "Layouting::HorizontalRule" LayoutItem
We have many horizontal separator lines in the UI, which are each time
repetitively created from a QFrame with some flags set. With the .ui
inlining, we will have more of these separators coming.

This change intoduces a Layouting::HorizontalRule LayoutItem and
replaces various existing QFarme separators with it.

Change-Id: I60bad89e2a2b777fbd2f9d0cf872af81e41dcfd7
Reviewed-by: hjk <hjk@qt.io>
2022-08-29 15:30:25 +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
Eike Ziller
64247bf571 Merge remote-tracking branch 'origin/8.0'
Reverts/comments out parts of 45f93a817a,
which needs to be resolved in a follow-up commit.

 Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp
	src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
	src/plugins/cmakeprojectmanager/cmakesettingspage.cpp
	src/plugins/python/pythoneditor.cpp
	src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
	src/plugins/scxmleditor/common/colorsettings.cpp

Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
2022-08-19 12:48:27 +02:00
Christian Kandeler
725c36e8d0 CppEditor: Keep offering "Extract Function" after all
As it turns out, there are some bugs in clangd that prevent this
functionality from working in some circumstances.
This effectively reverts 840263eb9a.

Fixes: QTCREATORBUG-28030
Change-Id: I511eb9a5cc45e3fd5e3cc25898aebb493f1ba3d3
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-16 11:08:22 +00:00
Marcus Tillmanns
a251126485 warnings: Fix unused/unnecessary lambda capture
Change-Id: I1d0ed78da53c56f0a87bf35b1ee2480f9dfd330c
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 10:22:29 +00:00
Jarek Kobus
44f1fd6498 Drop Qt5: Cpp/TextEditor: Get rid of QOverload
Change-Id: I010f211b40f876c0f033fd717aaa094f775ea214
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-26 16:58:45 +00:00
Eike Ziller
91fb0cf123 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/qmldesigner/qmldesignerprojectmanager.cpp

Change-Id: I5106bb632c2a3a144287097137be45b0894b9ee4
2022-07-04 08:53:22 +02:00
David Schulz
d09081d07c CppEditor: Initialize pointer member with nullptr
... when generating missing Q_PROPERTY infos.

Fixes: QTCREATORBUG-27770
Change-Id: I31d13ae6d6ed5b2be354097d48303d0cadfa253e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-30 08:48:55 +00:00
hjk
e2bb204d4d CPlusPlus: Inline more simple Type related functions
Change-Id: I2103e8047b385b438e58072e8a2689f1889d2724
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-28 11:02:22 +00:00
hjk
ffa3aad576 CPlusPlus: Inline some simple central functions
Depending on context, callgrind sees contributions of >8% to
the total cost of project parsing for these functions. The
functional are actualy executed executed out-of-line, often
for a function body of one "payload" instruction only.

Inlining removes the call/endbr64/ret overhead.

Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-24 11:49:41 +00:00
Artem Sokolovskii
5d8f13bfd4 CppQuickFixes: Add "auto" as local declaration incase cxx11
Add local declaration function add "auto " incase
cxx11 features are enabled.

Fixes: QTCREATORBUG-26004
Change-Id: I10da77e8baa52740b1c4df5a21d78ac5f0d1c5d6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-16 11:43:47 +00:00
Artem Sokolovskii
706dc654b9 CppQuickFixes: Add function getDeclaration for AddLocalDeclaration
Change-Id: Ie2d5c5de6b871a855b95efe7c633b28d6ed5c512
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-16 11:20:20 +00:00
Christian Kandeler
75502f2998 CppEditor: Fix check for static-ness
... in generate getter/setter quickfixes.

Fixes: QTCREATORBUG-27547
Change-Id: I29e937ae28c0bce7cd7745b92f371b97876f3e01
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-13 14:10:25 +00:00
Christian Kandeler
6e358cbdd4 CppEditor: Switch off "remove using namespace" quickfix with clangd
There is an equivalent tweak in clangd.

Change-Id: I895750f1e942f82da94f441b56b8a7d660ba7086
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-31 11:16:50 +00:00
Christian Kandeler
840263eb9a CppEditor: Switch off "extract function" quickfix with clangd
There is a clangd tweak that does the same, but better.

Fixes: QTCREATORBUG-13240
Fixes: QTCREATORBUG-18607
Change-Id: I59822c725ccb38d995fd8ac03861b1931b81f74c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-18 10:23:50 +00:00
Christian Kandeler
15665680df CppEditor: Use "auto" in AssignToLocalVariableOperation
Fixes: QTCREATORBUG-9577
Fixes: QTCREATORBUG-18412
Change-Id: I46a925611939a3dade142eaf76e20090ae203856
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-16 14:35:10 +00:00
Christian Kandeler
8c8e9e55b1 CppEditor: Refactor "assign to local" quickfix
Mostly to separate type and name deduction. No functional changes.

Change-Id: I87858f06bec73fbc59a0359769bd37038176b3ad
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-16 11:29:56 +00:00
Artem Sokolovskii
2be4e8c5d5 CppEditor: Remove foreach / Q_FOREACH usage part 3
Task-number: QTCREATORBUG-27464
Change-Id: Icbe620a83b6c2cf6b6166b76d01ca5f3c65ea87a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-12 07:42:02 +00:00
Christian Kandeler
938bef8959 CppEditor: Do not offer "complete switch statement" quickfix
... if the document is managed by clangd.
We should not offer the same functionality twice, and clangd's works
better.

Change-Id: Ifd8edfa91451ab70940a50b550c8d274ee93e6e0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-11 07:43:06 +00:00
Christian Stenger
2f64cf4779 CppEditor: Do not crash on anonymous classes
While performing generate getters and setters we crashed
when using members of anonymous classes.

Change-Id: I27dc8da950345aa4e26ddb1da3914edcffad5af3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-11 10:44:15 +00:00
Christian Kandeler
b8144e0c51 CppEditor: Use trailing return type when moving function definition
... if the original definition also used a trailing return type.

Task-number: QTCREATORBUG-27132
Change-Id: Iaeeeac08601f1d931aabe12be9f89ca0240d97a2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-05 12:58:39 +00:00
Christian Kandeler
d60c8787cd CppEditor: Only open refactored file in editor if we have a position
It's just confusing to the user otherwise.

Fixes: QTCREATORBUG-27114
Change-Id: I127d97ca165af0eb751cd6479d0ec0ffec480c17
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-28 14:24:31 +00:00
Christian Kandeler
3a03b50c7c CppEditor: Consider not only classes
... when trying to find out whether an include statement needs to be
inserted for a given symbol.
The previous code used to ignore e.g. function declarations, so an
unneeded refactoring operation would be triggered.

Fixes: QTCREATORBUG-26591
Change-Id: I5ce0bb064b6ba76e5977de73ea2697342cf74d7e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-22 13:49:17 +00:00
Christian Kandeler
49a8b021d9 CppEditor: Make pure virtual functions opt-in
... in the "Create implementations for all member functions" quickfix.

Fixes: QTCREATORBUG-26468
Change-Id: I0965290c38cc66cffaf5dd3871eb96b6ff24b4d2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-27 09:19:22 +00:00
Christian Kandeler
404cf0f632 CppEditor: Mark generated setter as slot only for QObject-derived class
Fixes: QTCREATORBUG-25789
Change-Id: I79174bcd617eb54540009491031cfae380383c41
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-22 12:34:51 +00:00
Christian Kandeler
6dd66e012b CppEditor: Fix possible crash in CompleteSwitchCaseStatement
There can be an unexpected null pointer if the built-in code model fails
to parse the code properly.

Fixes: QTCREATORBUG-26316
Change-Id: I5751be505b1182df17f58e1a174d645cef1e95cf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-13 14:05:37 +00:00
Christian Kandeler
50046dbc54 CppEditor: Fix "decl from def" quickfix with templated return type
We must treat return and parameters types of the function differently
from the function itself with regards to template parameters. This was
already done for parameters, but not for the return type.

Fixes: QTCREATORBUG-26248
Change-Id: I44cf6f0bda7b5e3c38f9f73e13f51f2c12ab7dc4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-14 08:22:27 +00:00
The Qt Project
934c0bc423 Merge "Merge remote-tracking branch 'origin/5.0'" 2021-09-07 10:06:01 +00:00
Eike Ziller
8e51295959 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/libs/utils/processreaper.cpp
	src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
	src/plugins/cmakeprojectmanager/cmakeprocess.cpp

Change-Id: Ie248bcb02a80f3e02ab19d73033ce2ba31e7fd83
2021-09-07 11:05:40 +02:00
Christian Kandeler
0b86b455b0 CppEditor: Put the locator filters into one file
These classes are strongly related, so no need to spread them around.

Change-Id: I4258b0c4198b3c650454ac734d7e52e09f46a4eb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-07 08:09:42 +00:00
Christian Kandeler
548e19370e CppEditor: Remove CppToolsBridge & friends
This redirection did nothing except to horribly obfuscate the code.
Note that most callers already accessed the model manager directly, and
some bridge functions were not called at all.

Change-Id: Ic1c728afe79bf98544da23a1955ee82d0dbde94f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-06 09:49:36 +00:00
Artem Sokolovskii
83e926f1cd CppEditor: Fix space issue for auto generated Q_PROPERTY
Change-Id: I3744ecfc18c7291666f346ea7b047ee749672e05
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-03 08:37:25 +00:00
Artem Sokolovskii
17c6fb866c CppEditor: Add property name to the generated signal
Task-number: QTCREATORBUG-26184
Change-Id: I4689dfb8b74de154092b7916188159432a5c827d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-02 14:02:38 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00
Christian Kandeler
a952500e90 CppTools: Use only const pointers for ProjectInfo and ProjectPart
All members were already const, but this makes it clear at all points of
use that these data structures are immutable.

Change-Id: Iea615c090bde462c445d15223caccc561b0c713d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-27 10:53:54 +00:00
Christian Kandeler
b152f3ace8 CppEditor: Do not produce invalid code when escaping string literals
Fixes: QTCREATORBUG-26003
Change-Id: Ie4d0ae85cc0ae2d1d45ae0bedbf0212d217aa69b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-02 14:29:39 +00:00
Christian Kandeler
4ff26e2a27 CppEditor: Do not rely on object identity when comparing names
In particular, the same namespace can be declared in lots of different
places.

Fixes: QTCREATORBUG-25776
Change-Id: I7e255cee560043ed4beb47b8047f99c3a9c21198
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-24 13:46:25 +00:00
David Schulz
79b9a2fea6 TextEditor: filepathify RefactoringChanges
Change-Id: Ie97e484bcdeaa0cb2f5d04b3c79ace55ff2e426c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-08 11:40:10 +00:00
Andy Shaw
df540d5611 Remove the inline keyword when moving implementation to cpp
Since the implementation has been moved to the cpp file, then
the inline keyword has to be removed otherwise it will cause a
build error.

Change-Id: I145bbaeb02674bd68501f1a41787bd4aa2a75f53
Fixes: QTCREATORBUG-20703
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-27 10:21:41 +00:00
Christian Kandeler
ecafdb7543 ClangCodeModel: Add experimental clangd support
If the user has enabled clangd (default is off), we start up one instance
per project when it is opened/changed (including build config switches),
and trigger background indexing.
So far, the index is used to provide results for locators and "Find
Usages".
Per-document functionality such as semantic highlighting and completion
is still provided by libclang.

Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-04-22 07:32:58 +00:00
Eike Ziller
e9bf841dc9 Fix lupdate issues
Some wrong tr calls / missing tr functions.
Some places where we need to bring lupdate to the right track with
regard to namespace resolution.

Change-Id: Idf552054a34e24d9671db68c816bf37f4d403dbc
Reviewed-by: hjk <hjk@qt.io>
2021-03-22 15:00:37 +00:00
Leena Miettinen
4c58465b25 C++ Editor: Fix UI text to follow the guidelines
Change-Id: Icea20999410df78d01222d6ebcfb9cdd497d5068
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-03-18 10:24:19 +00:00