Commit Graph

73 Commits

Author SHA1 Message Date
hjk
17b20e0622 TextEditor: Tr::tr
Change-Id: I28aa68e25c53c3a4d1c370074d7b3318944dc45a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-18 07:02:12 +00:00
David Schulz
baa1e3c2e1 Editor: Allow to hide annotations for a group of text marks
The hiding is not persistent, so on the next Qt Creator start all
annotations are visible again. This is meant to quickly get rid of
annotations if there are to many irrelevant of a specific kind.

Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-12 10:19:10 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +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
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
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
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
ed8c775def Merge remote-tracking branch 'origin/8.0'
Change-Id: Icbb87ac8bcee5fb86042d3863a973573510651b4
2022-08-05 08:50:27 +02:00
hjk
c68f901aa8 TextMark: Delay context menu tooltip action creation
Change-Id: I25bad9a774a6d95162251c8f0512eb3f8439d9ae
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-08-04 12:58:12 +00:00
David Schulz
674efc0f95 TextEditor: schedule update document layout
When generating a lot of text marks we do not need to update the
document for every mark and every property that changes.

Change-Id: Ibba80138f6ebcbbe30a4f741979df69ad62608c1
Reviewed-by: hjk <hjk@qt.io>
2022-08-04 09:09:58 +00:00
Alessandro Portale
90ab2aa318 TextEditor: Improve the look of the TextMark tooltip settings icon
This introduces a non-"toolbar" variant of the settings icon and makes
TextMark use it.

Change-Id: Icc1cbb36ca1e0f86746175625c0eca9996d10121
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-07-21 11:18:40 +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
1ce044ef7a Editor: Update document layout only if the mark color changes
Change-Id: Ic0408e87422edcf880381a20d685b24c785919c3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-07-04 05:06:17 +00:00
David Schulz
f35cd3c13f Editor: skip unnecessary text mark priority reevaluation
Only remove and add the text mark to the text block user data if the
priority changed. In all other cases a layout update is sufficient.

Amends a8cad01887

Change-Id: I9f8552e766838917c0e296cc7f7c7730669c45cd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-24 16:39:22 +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
c5f424d696 Coco: use the diagnostic foreground color as annotation color
Change-Id: I4f0991c8956b0b31a441aa4348aaf8b7d0677dda
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-11 07:21:11 +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
David Schulz
a8cad01887 Editor: make sure to update marker on annotation change
Ensures an update for the markers editor widget after any of the
information displayed in the annotation has changed

Change-Id: I845e05f5103ee1615cfc3d7760cdfc2bbf510f32
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:01 +00:00
Alessandro Portale
716f0bd032 Avoid compiler warnings about truncation from double to float
They appeared when compiling against Qt 6

Change-Id: I6bb94168f9776a7fa416d51ff4bb3ca32c9f02fc
Reviewed-by: hjk <hjk@qt.io>
2021-07-09 15:25:44 +00:00
David Schulz
f66df921d7 Core: filepathify file renaming
Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 11:13:51 +00:00
Christian Kandeler
6fbe88b215 TextEditor: Queue call to ICore::showOptionsDialog()
... from text marks.
Direct calls appear to be unsafe, possibly because text marks are
transient.

Fixes: QTCREATORBUG-25623
Change-Id: I929ff6310c9d93b677f66acc8869e7aeceb5564b
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-04 07:27:59 +00:00
Christian Kandeler
765f518de3 TextEditor: Support tooltips for buttons in text mark tooltips
In case users don't find the icon self-explanatory.

Task-number: QTCREATORBUG-25150
Change-Id: I481b1ea7f510f065f83badcb91e127ac1c81f5a1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-02-05 12:43:17 +00:00
Christian Kandeler
a1c5dd93f5 TextEditor: Let TextMark subclasses provide a settings page
Task-number: QTCREATORBUG-25150
Change-Id: Id5bbdcf2db7afacb823140d77ebd5bc141ac7f81
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-20 14:17:35 +00:00
hjk
94df9822f9 TextEditor: Add a mechanism to provide dynamic icons and tooltips
... to TextMarks more easily by allowing callbacks in addition to
fixed values.

Change-Id: Ica9e7d54dd1a53a59dc11812857402d0b7594d6c
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-24 13:06:55 +00:00
David Schulz
e371eafd4b Editor: Calculate annotation color based on editor color scheme
Amends 9182d4eda7

Fixes: QTCREATORBUG-24644
Change-Id: Id34bfbc4ea3d1102835c7c1cf3afa1580dff01d8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-09-16 07:20:20 +00:00
David Schulz
67db5cb2de Editor: Use optional for text mark color
instead of an additional hasColor member

Change-Id: I658401bb91374b10420e070625cf61049cb3cc64
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-07 19:02:12 +00:00
David Schulz
9afc5305d6 TextEditor: more FileName -> FilePath renaming
Change-Id: Ia61868806db47561e7bf7ae9b3cfb1e62a085a7a
Reviewed-by: hjk <hjk@qt.io>
2019-10-01 07:54:11 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Eike Ziller
6d43aaf134 Merge remote-tracking branch 'origin/4.9'
Change-Id: I7bdb6a4658c5fca1a7e1dda5adbb5613dabc6d18
2019-02-19 09:08:53 +01:00
Friedemann Kleint
ec6b38dea0 Fix Qt 5.13 deprecation warning about QFontMetrics::width()
Replace by QFontMetrics::horizontalAdvance(), fixing:
warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated:
 Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]

Change-Id: I9991ffefe6e87e872dc35ba291d562e06b28ca64
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-02-15 15:12:02 +00:00
Nikolai Kosjar
da28d40030 TextEditor: Add more space before TextMarks' tooltip actions
Change-Id: I6331d60026da865f29c5ed2455f2399414f99900
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-15 14:15:56 +00:00
David Schulz
b41b5a0714 move text document for file path convenience function
Move it from language client utils to a static function inside
the text document.

Change-Id: I91bc72d0e978c1d843082e12bb8a0fa60a1bbc5e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-14 13:19:19 +00:00
Nikolai Kosjar
0df7468e51 Clang: Add tooltip action to copy to clipboard
...as selecting text in the tooltip was difficult and eventually got
disabled due to other problems - see
d58c0a9ac8.

This adds support for actions in TextMarks. They are displayed as
QToolButtons in a dedicated column in the tooltip.

Change-Id: I84ee3c3e4af573a80953786881d1333b00e4200c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-02-01 08:15:36 +00:00
Orgad Shaneh
8760c5024d TextEditor: Support hyperlinks in TextMark tooltip
Change-Id: I3fa4470fb06469286901025c350d636fcdd9410a
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-10-08 13:28:02 +00:00
Orgad Shaneh
41dee83bec TextEditor: Modernize
override, auto, nullptr, member initializers.

Change-Id: I04c6ebb683849568973bd7782fb5a3279267141e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-09-20 08:48:49 +00:00
Eike Ziller
45f8d221bf Use FileName in TextMark
Change-Id: I3666d95dc8ef3b7da099d6d30f5cb4678a349493
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-05-03 06:51:47 +00:00
David Schulz
5fb310828e TextEditor: reduce annotation painting artifacts
Request an update covering the complete annotation
rectangle if it is not part of the event rectangle
and Correctly calculate the position for the gradients.

Task-number: QTCREATORBUG-18855
Change-Id: I68b61459e6fd94949baebba25f965226f9d5e441
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-09 12:10:44 +00:00
Eike Ziller
efa5a7b6d7 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qtcreator.pri

Change-Id: If5f4a9821a23ac0df81eb84b3980f9cf7ecd70ba
2017-07-25 11:54:44 +02:00
David Schulz
698e323a73 TextEditor: Make annotation position configurable
Change-Id: Ib59c9770390523e1863ac507ce43512ba679c591
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-07-21 08:25:14 +00:00
Eike Ziller
1feb5c604d Merge remote-tracking branch 'origin/4.4'
Change-Id: I02e54f45d233b89ddaee9c87da9b9af2a56374b8
2017-07-21 10:08:05 +02:00
Orgad Shaneh
c2ecee517e TextEditor: Avoid removing text marks that were not added to hash
TextMarks with empty file names are not added, no reason to remove them.

Change-Id: I8647deaa1136294d2f7c3c63337d967afea675c2
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-21 05:19:18 +00:00
David Schulz
8c4127ebac TextEditor: Improve readability of text annotation
Change-Id: Iddcf6951b44a73cd3e9d740d9aba725fa4d7d663
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-20 13:15:23 +00:00
Tobias Hunger
7d33f0f061 TextEditor: Initialize some members
Coverity was complaining about these, in some places even rightly so:-)

Change-Id: Ia85cdd2c74f05edba6f0d4534aa9f2ee2a750595
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-20 12:45:53 +00:00
David Schulz
862dd4c6bf TextEditor: Simplify annotation rectangle computation
Change-Id: Ie04f545d24696d66645c367b2c25d643c3691908
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-18 06:53:30 +00:00
David Schulz
6591a01452 TextEditor: Add line annotations
Displaying short descriptive text of a TextMark at line end.
Currently implemented for ClangTextMark and BookMark.

Change-Id: Idc6b579bda0382ad94b2e236b715696396b10460
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-30 08:27:16 +00:00
David Schulz
1d57a7e566 TextEditor: Fix updating TextMark priority
Change-Id: Ie88b75507faf1f467b4e044f2b06e25aae32bdcf
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-06-27 04:40:20 +00:00
David Schulz
4322990926 Editor: Simplify text marks
Moving defaultToolTip and color from TextMarkRegistry to TextMark.
Allowing every instance of a TextMark object to define these
information.

Change-Id: Iec1794372cf902b34d343402074e3999e7f9faf7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-06-22 08:42:40 +00:00
David Schulz
daac41338e TextEditor: Simplify TextMarkRegistry
The registry is an implementation detail and doesn't need to be exported
so move it to the textmark.cpp file.

Change-Id: Ic103b122cb20063fa4bc220bdc90cecff27054aa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-05-30 05:01:16 +00:00
Ulf Hermann
883492c135 TextEditor: Set widthFactor from TextMark ctor
The text marks are added to the document from their ctor. The document
then uses the widthFactor to calculate the space needed for them. If the
widthFactor is only set afterwards, the calculated space is wrong.

Change-Id: Ic7d24f99cc78d1bf084b2b1cfdf6b955496072f3
Task-number: QTCREATORBUG-17833
Reviewed-by: hjk <hjk@qt.io>
2017-03-16 16:19:22 +00:00