Commit Graph

53232 Commits

Author SHA1 Message Date
David Schulz
f15cae2bac TextEditor: fix endless loop on adding cursor for selection
Since the find of QTextDocument is line based, it is not possible to
find selections spanning multiple lines in the editor. Triggering a find
on a search term containing a paragraph separator returnes an invalid
QTextCursor which always result in searching from the beginning of the
document in the add cursor for selection logic. Prevent that by checking
the selected text beforehand and add a safety net in the loop to verify
that we do not start over again on an invalid TextCursor.

Fixes: QTCREATORBUG-28709
Change-Id: I8c1b9d16e707fefbba6dc0a0a9ef21b8c82ebe19
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-23 09:58:25 +00:00
Eike Ziller
9256340e5b CMake: Fix missing path to Ninja from Qt installers
In the configure environment for MSVC toolchains.
The MSVC toolchain actually overwrites the PATH environment (triggered
via kit()->addToBuildEnvironment(result)), which it shouldn't.
But this is a minimal fix for Qt Creator 9.0 that also is in line with
what BuildConfiguration::baseEnvironment() does.

Fixes: QTCREATORBUG-28685
Change-Id: I0cb8e3c84419403672175bd581c16d90902e23ba
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-16 07:43:38 +00:00
Christian Stenger
274bb27cf3 AutoTest: Redo handling of data tags with spaces
This basically reverts commit 7684571e10 as it broke running
the test inside the debugger.

Change-Id: Iacd46e2b9fb5af813fbf17156fd847375d750480
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-13 09:58:57 +00:00
Tim Jenssen
2df52c4b8b qmlproject: fix qmlViewerAspect
- add its own settings key so it gets saved into the project settings
- read the correct placeholder text, commandLineGetter is set too late
  and would also create a loop (qmlViewerAspect is used to get it)

Change-Id: Iee3458cfe84e3f6b6750aa14d9d89347da21b37c
Reviewed-by: Burak Hancerli <burak.hancerli@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-01-12 13:46:09 +00:00
hjk
3f528de7db ProjectExplorer: Fix compilation with Qt 6.6
appoutputpane.cpp:272:12: error: cannot convert ‘const QList<ProjectExplorer::Internal::AppOutputPane::RunControlTab>::iterator’ to ‘ProjectExplorer::Internal::AppOutputPane::RunControlTab*’ in return

Caused by "QList: deprecate iterator<->pointer implicit conversions"
0220484329029fc7598dfe11ba35ea10c3126477
b6cbd9c43afc7e005c1f78e1d0f700524930ed71

Change-Id: I596ead9deafca1154b5a79495e707137b61a14d5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
(cherry picked from commit 8ee6b14f00)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-12 11:06:25 +00:00
Eike Ziller
394caa1fee Allow combo box scroll wheel when pressing Ctrl
Wheel scrolling was disabled for combo boxes in Qt Creator 9, because it
created more issues than it solved. Instead of completely disabling it,
allow wheel scrolling when simultaneously holding Ctrl.

Fixes: QTCREATORBUG-28578
Change-Id: I08bccf039b60035bf425fac95b6af6fad349f43a
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-11 13:11:27 +00:00
David Schulz
91b5274276 ClangCodeModel: do not highlight tokens as Text
Fixes: QTCREATORBUG-28639
Fixes: QTCREATORBUG-28637
Change-Id: Idfcfc6c61db9d5449ab14eda566ce704160bac54
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-11 09:29:27 +00:00
Robert Loehning
c2788b0f05 Debugger: Add missing space
Change-Id: Ibb8623392c1b0e759df198fab87a6059558236e9
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-10 12:07:05 +00:00
Christian Stenger
7684571e10 AutoTest: Fix handling of data tags with spaces
Change-Id: Ie725d8bf67b6a143f52c84b902b69a077a55a2bc
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-10 09:49:40 +00:00
Christian Stenger
6e7c257a8c AutoTest: Fix checked state for QtTest
Data functions and special functions may get handled as normal test
functions which obviously fails when executing tests.

Change-Id: I630fedcdbcc7577c1896f8cccbe77008a623900f
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-10 09:49:34 +00:00
Cristian Adam
a3153c535d CMakePM: Add default kit configuration hashing
This adds a QTC_KIT_DEFAULT_CONFIG_HASH variable containing the hash of
all the default Qt Creator CMake kit variables:
  * CMAKE_C_COMPILER
  * CMAKE_CXX_COMPILER
  * QT_QMAKE_EXECUTABLE
  * CMAKE_PREFIX_PATH

This way when a CMake preset changes any of these CMake variables a new
Kit will be created. Otherwise a previous kit containing different
values will be used.

Fixes: QTCREATORBUG-28609
Change-Id: I77b67e9c8fa15dc3ff2f22c5b63d4ca1c7670fdc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-06 18:01:32 +00:00
Artem Sokolovskii
ce1a547b6c CodeStyle: Fix preview update
Fixes: QTCREATORBUG-28621
Change-Id: I66a66d9c16933ebd8197f9e286e72dce7a621933
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-05 09:12:15 +00:00
Eike Ziller
0a74a1e99e Properly support relative paths in Link with Qt UI
Relative paths are resolved based on the applicationDirPath, so reflect
that in the path chooser too.
Also, do not resolve relative paths in the path chooser to absolute
paths when writing to the settings.

Change-Id: Iaeffa2cad1e145adbbc5c918b5f8ff14f6f2b31e
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>
2023-01-04 08:44:08 +00:00
David Schulz
f0dba78f48 Editor: fix crashing on updating snippet selections
The final selection is not tracked in m_selections and needs to be
handled explicitly. Also add an assert preventing unconditionally
accessing an out of bounds element of m_selections.

Fixes: QTCREATORBUG-28631
Change-Id: I1898418b1126bdaffccbdf0e483e2c659d191917
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-03 09:58:07 +00:00
Alexey Edelev
803fb4ce77 Replace ANDROID_NATIVE_API_LEVEL with ANDROID_PLATFORM
ANDROID_NATIVE_API_LEVEL is not handled by the android toolchain files
starting the NDK version r23b. We should set ANDROID_PLATFORM instead,
to specify the NDK platform version, that exists in all NDK versions
supported by Qt. Also the ANDROID_PLATFORM variable expects the
'android-xx' format as a value, so avoid cutting the 'android-' prefix
when adding the value to the CMake configure string.

Fixes: QTCREATORBUG-28624
Change-Id: Idd4ba472e46982162e5ad74e9fc6868e50e3b434
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-23 17:10:13 +00:00
Cristian Adam
70b3388684 CMakePM: Allow relative compiler paths for presets
You can have a preset with the PATH environment variable modified and
with CMAKE_C|XX_COMPILER CMake variables only as "gcc.exe" and "g++.exe"

Qt Creator now will search in PATH after the compiler file names and
work as expected.

Fixes: QTCREATORBUG-28602
Change-Id: I8520f6fcf5e542600fab08228d04d3709d3a8e8f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-19 11:52:37 +00:00
Artem Sokolovskii
3904539e0d ClangFormat: Fix crash when m_fileName is empty
Fixes: QTCREATORBUG-28600
Change-Id: I3e0d64eb892daa5c63abe7ec81b258bf96fcdb1b
Reviewed-by: hjk <hjk@qt.io>
2022-12-16 12:15:37 +00:00
David Schulz
1eb73e4eb3 Editor: prevent validating line number in unwrapped editor
Checking whether a position is inside the first line is also not for
free. Only check the line number of a cursor position if we expect the
editor to have multiple lines per block or in other words line wrapping is
enabled.

Change-Id: I0e3cb1fbd11c250677f7c11d1a5c780f60085ec2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-16 11:34:02 +00:00
David Schulz
f87fccafc1 TextEditor: prevent shaping text for indent depth painting
QTextLines cursorToX indirectly calls shapeText which is not for free.
We just want to have the x position for the line so there is no need to
shape the complete text to get the position of the first cursor.

Change-Id: I0ae636ed8250385b7ac77c6f37d45922bbf2e9bf
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-16 10:31:11 +00:00
David Schulz
c8e1201236 LanguageClient: Do not send out invalid errors
An error is expected to contain an error message so add one that misses
one. Additionally assert when trying to set an error to a response that
is invalid (does not contain message or code.)

Fixes: QTCREATORBUG-28598
Fixes: QTCREATORBUG-27856
Change-Id: I0631433d847610531758d297a93a5c7cdfdc6c1d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-16 07:05:55 +00:00
David Schulz
445c3624ff QMakePM: fix potential crash when accessing deleted members
Fixes: QTCREATORBUG-28370
Change-Id: I1767678221afc0d1a99194bce2d987a226998da5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-12-15 13:27:19 +00:00
Robert Löhning
7b073efe4a SquishTests: Update tst_QMLS04
Change-Id: I383e8f652ae233df7ed5bef93dcaa9a43fe95f0e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-15 08:32:58 +00:00
Robert Löhning
bbd5d6c7ae SquishTests: Update FindToolBar
...as seen in tst_CSUP05

Change-Id: I1736a4ec9c69a3db3fc98ea1234b0363ceeaef41
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-15 08:32:30 +00:00
Christian Kandeler
d0046ec435 ProjectExplorer: Consider the form "-D key=value"
... when filtering compiler options for MSVC macro extractions.
Otherwise we end up with a stray command line argument, breaking the
call to cl.exe.

Fixes: QTCREATORBUG-28016
Change-Id: I29979a4b968d2056a0feba61fee01d5ddc9aa28f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-14 15:46:43 +00:00
Eike Ziller
fdad6496f4 Fix language selection box
When Qt Creator is installed in a path with underscore.

Amends 451d02c88d

which changed the pattern matching from file name only to the whole
path.

Fixes: QTCREATORBUG-28591
Change-Id: Ice6a7cb34fd2bb98c384a3b7cb573614bb7a43b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-14 14:22:21 +00:00
David Schulz
e0b1f694e3 Editor: Fix deleting with numblock delete in multi text cursor
Fixes: QTCREATORBUG-28584
Change-Id: Ib65a933b61536d9a6342e82c51779c2a91983ec8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-12-14 06:20:05 +00:00
Eike Ziller
c8aca8a3ab Beautifier/ClangFormat: Fix style check box states
Broke when inlining the .ui file. Because the two checkboxes no longer
have the same direct parent, "autoExclusive" does not work, and it needs
an explicit button group.

Amends 4933697d9a

Fixes: QTCREATORBUG-28525
Change-Id: Ia6af5f6083975faa5a65cdc9dd0bd2b671af147b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-12-13 08:47:43 +00:00
Jarek Kobus
168ff2c68c CppTypeHierarchy: Fix showing type hierarchy
Don't repeat the main symbol as its child inside
derived hierarchy. The regression was introduced
when addDerivedHierarchy() was added.

Amends e2155a91df

Change-Id: I34cd19be4307d355ea84fbdb64a06d0d3505e8a9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-12 15:20:04 +00:00
Artem Sokolovskii
8addb599a9 ProjectExplorer: Fix Add button alignment on Compilers tab
Fixes: QTCREATORBUG-28367
Change-Id: I468729fc2fd46f7f55081a696ff9d8913f5823d0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-12 13:15:21 +00:00
Jarek Kobus
218b19fe14 SshProcessInterface: Limit waiting for kill to finish
This is just a workaround for 9.0 and not a proper fix!

It looks like sometimes kill command may freeze. Don't blocking
wait for it for 30 seconds - limit this time to 2 seconds.

Do the same inside SimpleTargetRunner. Pretend the process
finished after 2 seconds, otherwise the SimpleTargetRunner
object gets leaked and we start receiving asserts from
ProcessLauncher about destructing it when still some processes
are being run.

Task-number: QTCREATORBUG-28072
Change-Id: I9766e7ff6f0c2abf2010686027702d30d32c4318
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-12-12 10:36:08 +00:00
Jarek Kobus
2596f39823 VcsBase: Fix connection in revertAll()
The original intention was to connect to done signal
of the executed command.

Change-Id: I35e1f931a54bf763c3d9ffc71237b1d96cda1343
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-12-09 11:24:27 +00:00
Artem Sokolovskii
69abc39aea CodeStyle: Fix save settings without applying
Change-Id: Iebe4c4fb6f3279592e7933981aba69087db558f9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-09 11:17:00 +00:00
Jarek Kobus
6a7f5be0ea PluginGenerator: Fix returning the error message
I bet the original intention was to return a new message,
so we should assing a new value into the passed pointer
rather than change the local copy of a pointer so that it start
pointing to the local variable.

Amends aaa8beab88

Change-Id: I1fdc8f3f4ea43e4814f02dbf615ad128bfc9a059
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-08 15:16:15 +00:00
Jarek Kobus
154e3df17e CppQuickFixes: Fix possible null dereference
It may happen that we dereference null inside the following
condition:

  if (declarator->postfix_declarator_list)

This may happen in case we entered the "if (!declarator)"
condition, but didn't fulfill the nested
"if (path.at(n - i++)->asPointer())" condition.

Detected by clazy analyzer.

Change-Id: I47135bc5648459e91664a4f65f9752b58248a496
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 14:10:53 +00:00
Jarek Kobus
b0e6943491 TextEditorWidget: Ensure non-null source is passed to insertFromMimeData
Detected by clazy analyzer. The possible context was
TextEditorWidget::dropEvent(). In some branches we ensure
that mime is not null, but later we call insertFromMimeData()
unconditionally.

Change-Id: Iee5138bc19d405050eafc9617d3c2ed123b767c7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-08 13:52:12 +00:00
Cristian Adam
6bef53a818 PE: Add ability to skip vcvarsall.bat /clean_env
By defining QTC_NO_MSVC_CLEAN_ENV one can skip the vcvarsall.bat /
clean_env functionality.

Task-number: QTCREATORBUG-28561
Change-Id: I6392b2278008607042a43a38a2c38669b4b52183
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-08 12:21:26 +00:00
Eike Ziller
deb454d8fb SaveItemsDialog: Fix default button
Changed when removing .ui file. Call order is important here.

Amends b3e3de517d

Task-number: QTCREATORBUG-28536
Change-Id: I04d9351f8bb7f2ed170f3643ba84af5f8afe35ab
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2022-12-08 08:05:13 +00:00
Kwangsub Kim
b4015fc345 BareMetal: Auto-detection of IAR toolchain version 9
The Windows registry node containing the installation path of IAR
workbench changed since version 9 that is the same as the one for
32-bit Windows host. Multiple registry keys will be used to identify
the latest IAR toolchain as well.

Task-number: QTCREATORBUG-28245
Change-Id: I92ed0c10a38e081ca45fcf9e543d902a3e98efc2
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
2022-12-07 16:37:34 +00:00
Christian Stenger
ea01c74d50 Squish: Ensure using correct case while debugging
Especially on non-casesensitive OS we may get the information
regarding break point locations with a wrong case which would
try to set a break point and silently fail as the files are
internally used with their correct case.

Change-Id: I32a780629e1b10ea075d669b8eca812fbd994600
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-12-07 14:42:06 +00:00
Christian Stenger
e620299fda McuSupport: Fix tests on Windows
Change-Id: I465fa2dc93ddeed2b3ef3d754b3992f88973862f
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-12-07 14:06:35 +00:00
Jarek Kobus
0c9706ada9 CppTypeHierarchy: Don't keep pointers to temp objects
When building type hierarchy the pointers to list
elements were put into queue. Later, the list was
modified and it was possible that list detaches
causing stored pointers to be invalid.

Simplify building type hierarchy by adding helper recursive
methods.

Fixes: QTCREATORBUG-28529
Change-Id: I240513fc097536d2175e2242766127b92aaa6a82
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-07 11:28:15 +00:00
Jarek Kobus
e2155a91df CppTypeHierarchy: Don't create/store QIcon in non-GUI thread
Store Utils::CodeModelIcon::Type enum instead.
Drop unneeded CPlusPlus::Symbol *declaration from CppDeclarableElement.
Remove unused CppClass::operator==().

Task-number: QTCREATORBUG-28529
Change-Id: Ie3487fa5f73d714ef375c42f1e64023ccc4194ee
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-07 11:24:34 +00:00
Eike Ziller
d8343b4b46 Fix crash after closing preferences opened from indexing progress
The preferences dialog is modal and creates an event loop that would be
running within the mouse event handler of the widget. When the dialog is
closed after the widget is destroyed (i.e. after indexing finished),
control would be passed back to the destroyed widget, and crash.

Fixes: QTCREATORBUG-28566
Change-Id: I71efa683822b5682ad1b38c39ce8f73c89bdd610
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-07 09:26:10 +00:00
Artem Sokolovskii
f93404d405 CodeStyle: Fix loading settings at the start in codestylesettingspage
Fixes: QTCREATORBUG-28450
Change-Id: I578c6cd102e4753d3af562986dad62e10e54d06d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-06 12:44:45 +00:00
Christian Stenger
538b77e376 CompilationDatabasePM: Fix test on Windows
Change-Id: Id771d3fbcb111ef3b8c4177981794c3bd841cedc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-06 12:30:04 +00:00
Ulf Hermann
d6484109b7 Add missing Q_OBJECT to PerfRunConfigurationAspect
Without this we cannot identify the aspect when trying to retrieve the
settings. Therefore, we always run without any settings, and in
particular with an empty command line for perf.

Fixes: QTCREATORBUG-28545
Change-Id: Ia419c939d57ff65eca4992faff02c121ca20c83f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-12-05 16:47:05 +00:00
Christian Kandeler
36ebb4bf22 CppEditor: Move "Show Preprocessed Source" action further down
... in the menus.

Fixes: QTCREATORBUG-28537
Change-Id: I51b4a258da8d654521d0e32256a7143960898227
Reviewed-by: hjk <hjk@qt.io>
2022-12-05 15:27:11 +00:00
Cristian Adam
9deef74d9e CMakePM: Allow presets inherits for deeper hierarchies
Fixes: QTCREATORBUG-28498
Change-Id: Idea5cdec6ad6acfba289dd77632770b7dfbf64f2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-12-02 16:23:46 +00:00
Jarek Kobus
c37ee615a6 ICore: Fix possible crash in raiseWindow()
Don't call else branch with nullptr when window is nullptr.

Amends 79be19a8a0

Change-Id: I4c1ee3783d36374cbc6ad9555328b5737f2ce348
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-02 14:00:07 +00:00
hjk
b88611f663 Core: Fix capitalization of external tools dir
Amends 451d02c88d.

Change-Id: I7e00c1f6262510f71d83a2f668b3b0353df6fce2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-02 11:26:21 +00:00