Commit Graph

468 Commits

Author SHA1 Message Date
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
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
Eike Ziller
42e072f159 Move MinimizableInfoBars from CppEditorDocument to IDocument
Similar to the InfoBar.

The only thing that an editor implementation needs to do is to set a
settings group and the possible info bars in the document constructor.
And later call document->minimizableInfoBars()->setInfoVisible(id,
visible) to manage the state.

Change-Id: I23afb3639b70b1bfccd424579da018280a7fe2cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-10 13:16:22 +00:00
David Schulz
58b0a5056c Editor: Allow selecting a group of whitespaces with double click
Fixes: QTCREATORBUG-24607
Change-Id: I993e2c3a8f1054fc6787cca8e22704fb5b2ab9d1
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-29 07:12:23 +00:00
Eike Ziller
e2d5b6616a Merge remote-tracking branch 'origin/7.0'
Change-Id: I01ce83a2da66bb65af37c0ecc92372789cb85c01
2022-04-22 10:04:39 +02:00
David Schulz
2529b62315 Editor: improve open link via mouse press
It improve in the situations where the mouse move slightly between press
and release event, this should be mostly notable for trackpad users.

Fixes: QTCREATORBUG-26595
Change-Id: I36ef7d23c80c09b9248abd8313c040993ece92a4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-21 08:01:23 +00:00
David Schulz
3f9c1d5d2b Editor: fix selecting multiple block selections with mouse
Change-Id: I5b46adbf38358d1396ee7120558648b1375e4047
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-20 07:45:12 +00:00
Marcus Tillmanns
cf81ff2a29 texteditor: Add Select Next Match function
Adds an Action to select the next occurrence(s) of the currently selected text.

Change-Id: I37e23a3c2d1651ec4898fac53d75044d92ed7079
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-13 12:58:09 +00:00
David Schulz
2b286c755b Utils: allow passing data via info bar combo box
Change-Id: I47daa83a533a76eb4ad0ab3f5cf8c04faf389b98
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-03-21 07:57:10 +00:00
David Schulz
d776445953 Editor: prevent repainting complete editor with for current line
Instead make sure that the widget is updated after the current line
changes.

Task-number: QTCREATORBUG-26812
Change-Id: I9fc754255891ec29d3499da0ee23aa56b1f285aa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-16 10:37:17 +00:00
David Schulz
b5457750f2 Editor: do not request updates for the complete annotation area
... inside the paint event. We should always make sure to call an
explicit update when we add, remove or change annotations via text
marks.

Task-number: QTCREATORBUG-26812
Change-Id: I5afbdad5e1916e99665b5cb1b1cd2a0bbf7335c3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-16 08:41:54 +00:00
David Schulz
525d26db03 Editor: centralize annotation filtering
Change-Id: I68464b14b44beee772ace93f7bdebc32ae3325ef
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:22 +00:00
David Schulz
32fc9653ed Editor: only update annoations inside event rect
Change-Id: I61c2648734c3d5b3018215a83e7d4226905a6993
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:16 +00:00
David Schulz
febe659690 Editor: filter text marks in paintAnnotation
Calculate the correct width for the annotation and decide inside
TextMark whether it can be painted or not. This will also
make sure that all annotation rectangles are correctly saved in
TextEditorWidgetPrivate::updateLineAnnotation.

Change-Id: I7e6c606e615b1673a34000618e106efb14184b10
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:08 +00:00
Eike Ziller
d295d16ab5 Merge remote-tracking branch 'origin/7.0'
Change-Id: I809383e6c060701a2751197a8bf16add92bfaf0d
2022-02-28 09:21:18 +01:00
David Schulz
4d10a2df36 Editor: only start block selection if alt and shift is pressed
Since it is a selection the shift modifier should be part off the
shortcuts and the old block selection also required both modifiers.
Additionally this prevents creating a block selection by accident when
there are no items in the editor history since alt + arrow left is
mapped to go back in history by default.

Change-Id: I46b0753a737f1e1b3c980d2e959bcf7b4733d790
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-25 10:25:30 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
Eike Ziller
8259df00d0 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/mcusupport/mcupackage.cpp
	src/plugins/mcusupport/mcusupportoptions.cpp
	src/plugins/mcusupport/mcusupportoptions.h
	src/plugins/mcusupport/mcusupportoptionspage.cpp
	src/plugins/mcusupport/mcusupportplugin.cpp
	src/plugins/mcusupport/mcusupportsdk.cpp

Change-Id: Ib423e9f23877176f01b188104b0a179ed32c4770
2022-02-22 14:06:41 +01:00
David Schulz
844a5e624a Editor: make sure to cleanup select all future watcher
Change-Id: I39e1bc7926905684601eb72cdd7a4357c708c432
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-18 11:04:51 +00:00
David Schulz
088d692bb2 Editor: fix crash after triggering select all with no search results
Change-Id: I32d5172e8b5df6db93053f358c5a72cb8d38f6ea
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-18 08:09:14 +00:00
Eike Ziller
fcb8d3b2a4 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp

Change-Id: Icda34067bb89d066a3e7eb47f8cca1d62dc3ae0d
2022-02-11 11:20:13 +01:00
David Schulz
a1cc9b4e5c Editor: fix internal cursor position after backspace
Fixes: QTCREATORBUG-27035
Change-Id: Id39d8832c5e3327cd42ce10447da98ca78fe476d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-10 08:00:42 +00:00
David Schulz
08e375d6f7 TextEditor: add highlighter configure based on mimetype
The default implementation configures the generic highlighter based on
the documents file name and content. Add a way to force the highlighter
to use a highlight definition for a specific mime type.

Change-Id: I1c6fca1be9bcb5c4276b5aa2dbb724680fe98ddc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-04 11:41:50 +00:00
Eike Ziller
1368111824 Merge remote-tracking branch 'origin/6.0' into 7.0
Change-Id: Ie2b23daa457c2aed635a784963bc1e95740bd076
2022-02-02 10:17:03 +01:00