Commit Graph

540 Commits

Author SHA1 Message Date
Eike Ziller
3bdb1a3edf Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/vcsbase/vcscommand.cpp

Change-Id: I2d33113bfb2ea7134550cda1de4e2c21e6711778
2022-10-18 16:51:36 +02:00
Eike Ziller
ea5a050c5c Merge remote-tracking branch 'origin/8.0' into 9.0
Conflicts:
	src/plugins/mcusupport/mcusupportsdk.cpp
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/qmldesigner/components/materialbrowser/bundleimporter.cpp
	src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp

Change-Id: I9317da0fc1243b9ce6d87f577aa843c51f132ad7
2022-10-18 10:48:46 +02:00
David Schulz
93c15f48dc Editor: ensure cursor is visible after handling backspace
Fixes: QTCREATORBUG-28316
Change-Id: I1e8c9229704c700ad76f6906b1a220948c819c1b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2022-10-18 06:49:31 +00:00
David Schulz
b2dbc0965c Editor: Fix double click in editor behind content
Fixes: QTCREATORBUG-28083
Change-Id: Ie198c2f1c9911ec85ee555ff1058d2528f9e6b7d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-13 12:11:58 +00:00
David Schulz
bf5a8835ee Editor: improve visual indent depth for empty blocks
Use the indenter based visual indent only for the cpp qt style indenter
since it gives accurate results. In all other casess Look for the next
and previous not empty lines and use the minimum indent depth of those
lines as the visual indent depth for empty lines.

Task-number: QTCREATORBUG-28179
Change-Id: Ic456fba5adfb2a12f20e2bd4fc663010c752b65c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-10 08:36:07 +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
David Schulz
8dcb22d5e9 Editor: fix go to line start
Do not try to find the first none space character of a block if we
already handled the home key for a line that does not contain the start
of the block.

Fixes: QTCREATORBUG-28198
Change-Id: Ia2966baeae8f068cd21d716e097782ae3b5a1d86
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-07 08:05:52 +00:00
David Schulz
33177686fd TextEditor: do not replace nbsp with normal spaces
This fixes saving documents and copy texts that contain non breaking
spaces.

Task-number: QTCREATORBUG-17875
Change-Id: Ie0b0e68cf7d67e768ff99c9acae1937aafc78ce7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-04 09:52:35 +00:00
David Schulz
08a7dbd046 TextEditor: reorder TextEditorWidgetPrivate member initialization
Change-Id: I369a0856c787873f2272cda92878f413648bad8d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-30 08:13:19 +00:00
David Schulz
01ddb61ab7 Editor: Fix reassigning a document to an editor
Moving all initializations that are not influenced by the document to
the TextEditorWidget(Private) constructor. So we do not reinitialize or
double connect unintendedly.

Change-Id: I42f4e8166c21aec9c8b780033b12eb8dae5f72a6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-30 04:19:17 +00:00
David Schulz
8c996891ae Editor: Fix reapplying tab and font settings
Change-Id: I6b6ee2d669089adf5db3ae8dabb5d2cc0ca628f9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-28 13:14:06 +00:00
David Schulz
e7fb5276af Editor: Fix reaplying display settings
After setting the document the display settings that are configured in a
widget might differ from the ones configured in the document. So Check
those values against the desired values from the editor and update if
they differ.

Change-Id: I30c5eddbb09803451fe03769d8e6d189293c5e86
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-27 10:03:24 +00:00
Jarek Kobus
7b77085652 TextEditorWidget: Prolong the lifetime of old document
The crash happens when calling TextEditorWidget::setTextDocument()
second time for the same editor instance.

Change-Id: I0a2febb50702673e2751a0d41fc0bc80cb6ba4a2
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-23 12:17:09 +00:00
David Schulz
45bd886e3e TextEditor: add find usage to context menu
... of the generic text editor if the editor has the FindUsage optional
action mask set. This is mainly used to show this action when a language
server is configured for this editor that supports find usages.

Change-Id: I55c6983cd553c46817332144f78f1207185ac3f6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-23 11:39:14 +00:00
Christian Kandeler
8e118e9d5e TextEditor: Prevent unwanted reflowing of doxygen comments
... in rewrapParagraph().
One could argue that this functionality is only for pure text and should
not be used on code, but since it was apparently contributed with
doxygen in mind, we might as well go out of our way a bit to support it
a little better.
The simple approach here is to treat a doxygen command at the start of a
line as the end of the reflow region.

Fixes: QTCREATORBUG-9739
Change-Id: I5affee9c441bd9e862bdaf38930fcf8e770b6d97
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-20 07:44:18 +00:00
Eike Ziller
5ae23f8c66 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	.github/workflows/build_cmake.yml
	src/plugins/qmldesigner/components/connectioneditor/dynamicpropertiesmodel.cpp
	src/plugins/qmldesigner/components/materialeditor/materialeditorview.h
	src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
	src/plugins/qmldesigner/designercore/model/model.cpp

Change-Id: I111b9140375b894a5487cc012b17cc32100bdb8d
2022-09-13 11:15:16 +02:00
Florian Koch
69fad91660 Re-introduction of the feature to adjust the line spacing
This already has been implemented in change
dc64f3207b, but was reverted with
change f220cb0e23) because this does not
work with text wrapping rendering, due to internal limitations of Qt.
Since this is a highly requested feature (e.g. QTCREATORBUG-13727), but
an internal change within Qt is not in sight, the approach taken here
is to offer the text wrapping feature in the settings only when the
line spacing is set to 100%. Additionally, a change has been made to
the layout of the display settings page to reflect this.

Fixes: QTCREATORBUG-13727
Change-Id: Ib233cf90a5f336bc591fa1bf860e162fa774dfe3
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-12 16:40:15 +00:00
Eike Ziller
2456f8f568 Convert file search API to FilePath
Fixes: QTCREATORBUG-28135
Change-Id: Iec8fcbae40adcccbe775de5719a657f5aa30a941
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-12 12:24:48 +00:00
Jarek Kobus
dbfdd334b5 Reuse FileSearchResultList
Change-Id: I2a20167faf78fcfa3b4bf392a42e0a72d92cd68e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-07 05:45:34 +00:00
David Schulz
d8fcaf0a73 Editor: paint location marker over everything else
The location marker is updated very regularly and especially while
stepping moves one line at a time. Resizing this marker when it enters a
line that already contains a marker is visually distracting. To prevent
this paint the marker over all other markers in that line.

Change-Id: I63ad72384e77eeae4dc6d2e2c2ac77c88da92c56
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-07 04:17:37 +00:00
David Schulz
8fab2011ba Editor: remove html from default mime data
This is known to be expensive and a lot of users actually prefer plain
text in the copied mime data to avoid unwanted coloring in 3rd party
tools. Add a separate action (Edit > Advanced > Copy With Highlighting)
that preserves the original functionality.

Change-Id: I0f3c529146ab94d0cd9ce9e3b997c8501a577f03
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-06 08:13:51 +00:00
David Schulz
9456052207 Editor: do not replace selection in drop editor
Only remove the selected text if the drag source is the editor and we
want to move the selection.

Fixes: QTCREATORBUG-28126
Change-Id: Iaa54d54c432df2da99e30ddb569e06e3ccd0df00
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-05 13:04:45 +00:00
David Schulz
c58f41face Editor: accept drop actions
In order to remove the selected text of another editor widget when
dragging text from one editor to another the drop event needs to be
accepted.

Fixes: QTCREATORBUG-28125
Change-Id: I8333fe096baf589e5669fc43370fc3519c72bb2d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-05 13:04:26 +00:00
David Schulz
82cb981dff Editor: improve indent marker painting
Slightly move the indent marker and paint also the the first level.

Change-Id: I8a80b8f694950e3240e69807de71a626a4adc16d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-02 06:00:59 +00:00
David Schulz
aebe8da072 Editor: paint indent marker for blocks containing only spaces
Results in a cleaner look since the indent marker are not interrupted on
lines that are for code formatting reasons empty.

Change-Id: I887071715e0224210684d131a93b3799f8504501
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-02 06:00:40 +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
David Schulz
ad4fed86ca Editor: improve painting multiple mark icons per line
Instead of painting them visually on top of each other paint them in a
grid with a number indicating how much marks are in total in that line.

Fixes: QTCREATORBUG-27415
Change-Id: Ifbf35c956670976b54e5084569d77a6f9e7f59a7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-08-31 08:21:17 +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
David Schulz
0bc3d74ea4 Editor: add and use editor toolbar outline setter
Simplifies switching between c++ builtin code model and clangd since we
can now react on new outlines in the c++ editor widget.

Fixes: QTCREATORBUG-27594
Change-Id: I76bdc301d78572cbdf4196658f751b5204743fbb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-25 12:29:17 +00:00
Marco Bubke
84c1d6572b Utils: Remove variant.h
Since we are now requiring macOS 10.14 we can remove our local copy of
std::variant and use for macOS std::variant too.

Change-Id: I589d03b35fc56878b7392ffa7047a439e588fe43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-23 09:51:43 +00:00
Florian Koch
4740430577 New option for disabling of tinting the right margin area in text editor
Since version 4.14 the right margin of the text editor is tinted. The
fill color corresponds to a darkened editor background color (for light
UI themes), or a lightened background color (for dark themes). However,
the default for most other editors and IDEs is just a single  vertical
line, as was the case in Qt Creator up until version 4.13. The different
colored area may be considered uncommon and irritating by some users.
Therefore, the new checkbox "Tint whole margin area" has been added under the
"Text Editor/Display/Text Wrapping" section in the settings for switching
between <= 4.13 and 4.14+ behavior.

Change-Id: I6761943477738a4c78b97a5f70a19f1ff8a428e5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-17 10:44:15 +00:00
Marcus Tillmanns
2d79bff3c1 texteditor: Add Cursors to Line Ends command
Adds a new function that creates new cursors at the end of
each line that was previously selected.

Change-Id: I6510002eae17af9cf00a2eedc5e56ef6fdcc8ef3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 11:32:21 +00:00
hjk
df4155f617 App: Use more local methods to trigger memory trim timer
The global event filter function is executed often, for events
originating deep in the widget hierarchy even multiple times.

Triggering the timer only by mouse and key presses on the main
application and on texteditor is less intrusive and still happens
often enough (TM).

Change-Id: I848d55a347bd62d12e8523965d1750c59da33116
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-02 11:18:12 +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
3ec87e37ee Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/todo/optionsdialog.cpp
	src/plugins/todo/todoprojectsettingswidget.cpp

Change-Id: I24ca90c2fc2cd707df901d42694df6d0e27d696d
2022-07-20 12:03:40 +02:00
hjk
802de0eb5e Utils: Collapse most of porting,h
Taking the Qt 6 branches, leaving some dummies until downstream
adapted.

Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-13 09:44:09 +00:00
Jarek Kobus
d1c98e43b5 TextEditorWidget: Fix createMimeDataFromSelection()
When omitting separator lines take the selection start
position instead of the position of the block where
selection starts.

Amends c98bd449523dc05f8875e96d06cf7c21e18eef0d

Fixes: QTCREATORBUG-27813
Change-Id: I6067a3ef6396d50162d8e253fe4a825d47d326b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-13 07:23:07 +00:00
David Schulz
8170501502 Editor: visualize indent
Paint a horizontal line every indent size in the whitespace at the start
of each block.

Fixes: QTCREATORBUG-22756
Change-Id: I044ccb4adefa4c8c9a3a610f0e996a810487fa1e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-07-08 10:12:42 +00:00
David Schulz
9eef4bd2f1 TextEditor: remove mark width factor
Needed to optimize painting of different text mark icons in one line.

Change-Id: Ia7f9dd12020e2a21875b3de54b65257f8ea337d9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-07-04 07:08:59 +00:00
David Schulz
b1eadd3bc6 Editor: hide "Hide mouse cursor while typing" option on mac
The mouse cursor is hidden unconditionally in Qt, so do not give the
impression that this can be disabled. Also we have a bunch of bug
reports that claim that the cursor does not come back if the mouse is
moved after typing. This might be caused by the double hide of Qt
Creator, Qt and the moon phase.

Fixes: QTCREATORBUG-27572
Change-Id: I11b39cac6cd8eb0717fca00d1812a4e052223f21
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-30 06:22:17 +00:00
David Schulz
bdfb07d701 Editor: Fix code folding marker visibility
... after split in new window.

Fixes: QTCREATORBUG-27748
Change-Id: Idc6270e3bbc39a5c1e679357ba0fbd840e5312c7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-27 13:01:41 +00:00
Alexander Akulich
2bf46d9e7f TextEditor: Add an option to hide file line ending combobox
Change-Id: Iae8160f7cd567fc6d42116837fc367fa6dffdc4b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-06-14 20:11:26 +00:00
David Schulz
b4b779d641 TextEditor: fix indent length calculation for rewrapParagraph
Fixes: QTCREATORBUG-27602
Change-Id: I43650be75807c9954eeabca4dbe6749de493f523
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-08 05:56:36 +00:00
David Schulz
33167f7f50 TextEditor: use tabsettings to get indent column
Change-Id: I23c84194633ba5cb485fefb6195fcbb3ad37d95a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-08 05:56:30 +00:00
Marcus Tillmanns
b82f321c9a texteditor: Add Select Next Match respect find settings
To increase the usefullness of the function, this change
adds the current search settings to the find() call.

This way the "case sensitive" and "whole words only" is taken
into account when searching for the next occurrence of the
selected text.

Change-Id: Ia4b28e84c39b9298d2dcbfa381ccf19d8137bfc6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-07 12:25:56 +00:00
Christian Kandeler
a167bd9ad2 Do not pass Utils::LinkHandler by rvalue ref
There is nothing special about this type that justifies it sticking out
everywhere it appears.

Change-Id: Iccdc95163d477db8a031d0d520f28fea26432a44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-07 09:22:30 +00:00
Christian Kandeler
5693c518bc Utils: Rename ProcessLinkCallback to something less clumsy
Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783
Reviewed-by: hjk <hjk@qt.io>
2022-06-03 13:23:28 +00:00
David Schulz
bcfa338fff TextEditor: stop HoverHandlerRunner on focus out
Since we might get a result for a hover request after Qt Creator lost
focus we need to prevent showing tool tips for a Qt Creator in the
background.

Change-Id: Iaa0eafdfe9340d2623fc4632dfc685463fd0d53a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-03 11:39:43 +00:00
Artem Sokolovskii
66f132dd9b TextEditor: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: Ie9594bf661dbeecf22589c1580648252f0bfb7fb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-19 07:33:27 +00:00
David Schulz
59a77a4965 TextEditor: add text cursor to assist interface
This will allow us to request assistance for a specific selection
instead of just the position.

Change-Id: Ib8e5b32d4a8f2936e5a6f1b7ac968d7f1d8d9de6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-13 09:18:53 +00:00