Commit Graph

363 Commits

Author SHA1 Message Date
David Schulz
b1a3c0bba4 TextEditor: Restructure TextEditorWidget::paintEvent
Splitting the paintEvent method into various sub routines to increase
the maintainability.

Change-Id: I4aa7a52aa6e20279654784b55f92053d6ede00be
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-23 10:58:08 +00:00
David Schulz
72c283afc8 TextEditor: Add data container for editor widget paint event
The container is used to initialize and group data that
is relevant during a paint event.

This conatiner will be used in follow up patches as an argument
to subroutines.

Change-Id: I00c8bafff526e2d90776e7ea75621fc5e4c2981f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-20 06:17:27 +00:00
David Schulz
ae68aa5610 TextEditor: Update position of annotations outside event rectangle
Change-Id: Ie7d3db989b48a605fad4642c339940d67e505e1e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-17 11:48:39 +00:00
Christian Stenger
13717262a1 TextEditor: Fix determination of maximum width
Width is not zero-based.

Task-number: QTCREATORBUG-19091
Change-Id: I32134727bed204f6bb10748cd067a775f673b89b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-17 11:46:10 +00:00
David Schulz
79bdd7e14f TextEditor: Fix update loop for annotations
Task-number: QTCREATORBUG-19091
Change-Id: I5f699747df10e25d412b2eec4620c3b51ad628e3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-16 09:54:33 +00:00
David Schulz
4a3765d64c TextEditor: Use visual whitespace format for line wrap arrow
Change-Id: Ifbf31010171ea4fd762457337ed56f60c19d5b4c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-10 09:09:16 +00:00
David Schulz
c2686fd9ae TextEditor: Fix annotation rectangle caching
The rectangle of an annotation is cached after it was painted. If just a
part of an editor was updated all annotations were removed but only
redrawn annotations were added to the cache again.

This behavior is replaced by removing annotations that are not visible
and those which got redrawn. So annotations that are still visible but
were not redrawn are kept in the cache.

Change-Id: I9246f1347b8f795284fb4fc9aabe11f251d16c25
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-09 12:31:33 +00:00
David Schulz
26d0b536ca TextEditor: cleanup annotation rect cache after mark is removed
Change-Id: I8a0ab2df9d310da6025325ab3114eeadabfd4fb1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-09 12:31:24 +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
David Schulz
cf624f92bd TextEditor: Optimize line annotation painting
Paint an annotation only if the event rectangle
contains the block for that specific annotation

Change-Id: I5f992f916da25268dd2c9e6b4703701934c8551d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-09 12:10:20 +00:00
Orgad Shaneh
5e8e619dd0 Merge remote-tracking branch 'origin/4.4' into 4.5
Change-Id: I9b7cb3d845628abf69a73a279f5a79202c0976c2
2017-10-04 16:11:17 +03:00
Serhii Moroz
6afdb8bdf9 TextEditor: Disable block selection if file was changed in other editor
Task-number: QTCREATORBUG-18770
Change-Id: Iccdc3deb354599bf1fd6f1cb8c0d5a1765ecb471
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-02 08:30:11 +00:00
Eike Ziller
cfdea6b9c2 Merge remote-tracking branch 'origin/4.4'
Change-Id: I7bf72444b19db20fcc7dc2c9d1f02ec2b30b658f
2017-09-25 11:00:25 +02:00
Ivan Donchevskii
80a472740d TextEditor: move convenience from texteditor to utils
Allows to use this header without texteditor dependency.

Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-22 12:59:35 +00:00
Serhii Moroz
0bf27af0a7 TextEditor: Fix blockSelection painting in "Text Wrapping" mode
Change-Id: I1ba4587ce4f8e88a1c81c5ac3c9d6dac582bd71f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-09-19 13:48:06 +00:00
Friedemann Kleint
4710e6b4b2 TextEditor: Fold Python/Perl/sh license headers
Skip shebang and fold the first comment.

Change-Id: I06d55931555f1c77f08bf30427ae7072f38b02da
Reviewed-by: hjk <hjk@qt.io>
2017-09-13 06:40:14 +00:00
Serhii Moroz
bb58ab34c1 TextEditor: Add sortSelectedLines action
Change-Id: Ifdc82766bac3cfe2e9c287b4ef04902a943c8f72
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-09-11 17:43:02 +00:00
Eike Ziller
c2ef4b52d3 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I9620928b431cefa995a06db85ecfcb92f225f732
2017-09-06 12:19:18 +02:00
Eike Ziller
ca3b882ab8 TextEditor: Fix painting with frame turned on
When using our text editor in a normal panel, we want to turn on the
frame again. Make sure that the extra text editor area does not overlap
the frame, and also make sure that there is no extra area shown at all
if all its features are turned off.

This fixes the painting of the input fields in the Clang Query advanced
search.

Task-number: QTCREATORBUG-18815
Change-Id: Ie74f87ddc576c02cd5ea7650f2632fe91df143eb
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-05 12:04:17 +00:00
Eike Ziller
c01ddc4660 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/qbsprojectmanager/qbsproject.h

Change-Id: I6b9cdf704be95ade02488c8b19582b6621282fb8
2017-07-28 15:24:14 +02:00
David Schulz
c7abc41d97 TextEditor: Make text snippets available in all editors
... that do not define their own completion assist provider

Change-Id: I8edb65647a55178d4388b26c95cdeb301ff9f3fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-27 07:49:06 +00:00
David Schulz
5294c68c98 TextEditor: Add display settings page link to annotation tool tips
Change-Id: I453127693dd1e0b30918333ac6866ac2fca4baa6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-25 12:00:49 +00:00
David Schulz
3ec59b46df TextEditor: Use member initialization in TextEditorFactoryPrivate
Change-Id: I97a077a922208545b5a6c7dc07c4de667fa0d833
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-25 10:51:49 +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
Marco Bubke
9428624fc1 Clang: Tool tips for clang query diagnostics
If you hover a diagnostics in for a clang query you get now a simple tool
tip.

Change-Id: I6352dd3d4b9a33c183e69037eac903469b90eea4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-24 13:37:18 +00: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
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
Nikolai Kosjar
c8a543b949 TextEditor: Make TabSettings accessible for AutoCompleters
Change-Id: I3591ad94ca98979c2d47585d33800a489d87eeda
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-20 12:35:10 +00:00
David Schulz
1ebc364349 TextEditor: Jump over braces inserted by the TextDocumentManipulator
Task-number: QTCREATORBUG-16946
Change-Id: I445c5698da59230f1d6ae859e6bbf20d26fc5bb9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-07-18 21:14:35 +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
671e3eba3d TextEditor: Use a constant offset for the annotations
Do not check whether a refactoring marker is visible, but always provide
enough space to display one.

Change-Id: I3f9dbb973b9067bd8177773d6fc878b47427232e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-10 08:19:27 +00:00
Joerg Bornemann
e8dfe2f91d Fix namespaced build
Change-Id: Idf7716093c0fdaeb494d9427a894a4ea44cab95a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-07-04 16:19:14 +00:00
Eike Ziller
526e40cba3 Merge remote-tracking branch 'origin/master' into 4.4
Change-Id: I00fe351ee5f2689366c63ba94b042609c47da777
2017-07-04 13:55:35 +02:00
David Schulz
15750db434 Editor: Correctly reset cursor for automatically inserted text
Change-Id: I7f9eee035cf3b85321de6d3f2a7a1d62e4e58376
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-04 09:06:02 +00:00
David Schulz
9d8b8ba65d TextEditor: Animate automatically completed text
Change-Id: I35a183821363a201a68200f8692bf18dd36faed7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-03 12:34:36 +00:00
Nikolai Kosjar
999e6bc671 TextEditor: Allow asynchronous hover handlers
Change-Id: I956b126e2c779aa81f86e4432d127b45ac1912ff
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-03 07:42:12 +00:00
David Schulz
6e51fd2a0c TextEditor: Use correct format for auto complete highlight
Change-Id: Icb9800a286417077985ad9c0acedeb9b06b456cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-03 07:37:17 +00:00
Nikolai Kosjar
7a09bb4418 TextEditor: Reduce BaseHoverHandler::identifyMatch() calls
...because they are potentially expensive.

Change-Id: Iaa235ea1fa864a0a67f3ed10b7f89d23179c642b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-30 08:58:07 +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
c9d898ed6d TextEditor: Fix jumping over nested auto inserted characters
Task-number: QTCREATORBUG-16946
Change-Id: Ic652147d76ecc93ff5607b3af733762b0d5c2738
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-06-30 05:53:26 +00:00
Nikolai Kosjar
50790f6187 TextEditor: Avoid unneeded calls in BaseHoverHandler
In checkToolTip(), the call to decorateToolTip() is not needed since it
does not affect the priority.

In showToolTip(), we can assume that checkToolTip() was called and thus
avoid a call to identifyMatch().

TextEditorWidgetPrivate::processTooltipRequest() is the only caller of
checkToolTip() and showToolTip().

Change-Id: I362c697754b6a29c9c0b34f85d3022f00e3e1031
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-29 08:01:35 +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
6036739e0c Editor: Separate color and id in the highlighter scrollbar
This allows to define a color for each highlight, and not just for
groups.

Change-Id: Ia027f1fb42a96c431b5889ec132a59b16ae41fbb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-06-15 11:52:47 +00:00
David Schulz
2b83869236 TextEditor: Animate navigation within file
Change-Id: I490d70a785c947cd41809503e15a317152126641
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-06-15 09:24:07 +00:00
Jesus Fernandez
f3cd5cdb7e Add a ShowContextMenu action
Allow users without physical MenuKey to open the context menu

Change-Id: Id886a5614e26d614cba6ceb3b08a9df6148e9655
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-09 10:30:35 +00:00
Eike Ziller
2684254fad Fix text based Android manifest editor actions
All text editor actions were disabled. We want the actions to be enabled
when the focus is in the text editor widget in the Android manifest
editor.

For this the text editor action handler must differentiate between the
_editor_ and the _context_ that it handles. The one for the text based
manifest editor handles the manifest editor, but the context is specific
to the text editor part.

Change-Id: Ib91cc763cb27333a7d5b6e5b036dfead33961871
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-18 07:08:56 +00:00
David Schulz
0ecc044478 TextEditor: Add delete(Start/End)OfLine actions
Task-number: QTCREATORBUG-18095
Change-Id: I75e6141687ba5e96ef59384b302357700f79dd55
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-04-26 09:48:43 +00:00
Eike Ziller
73f2c0f4e8 Allow giving TextEditorFactory custom CommentDefinition
It was not possible to set custom comment styles.
Also simplifies the code for the predefined styles.

Change-Id: Id7f345d65b747bfac5a15e3eb15cd2beb106b281
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-04-26 07:34:29 +00:00
Alessandro Portale
3624a663d8 Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many
cases in our code, these functions are unnecessarily called as instance
functions, using the qApp helper.

This patch replaces many occurencies of qApp with the according
Q*Application classname.

Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124
Reviewed-by: hjk <hjk@qt.io>
2017-04-24 18:36:28 +00:00