Commit Graph

175 Commits

Author SHA1 Message Date
Jarek Kobus
990da15c1e Refactor HighlightScrollBar
Rename it into HighlightScrollBarController.
Don't derive it anymore from QScrollBar.
Make it based on QObject and decorate
the existing instance of QAbstractScrollArea as needed.

Fix the highlight of the shared scrollbar of the SideBySideDiffEditor.
Both left and right diff editors have their own
HighlightScrollBarController and their own separate overlays, but both
overlays are created as children of the same right editor instance.

Synchronize also the cursor between left and right editors.
Make highlight current line working.

Make the overlay transparent for mouse events - this fixes
issues on macOS when scolling over invisible scrollbar.

Change-Id: Iab05c360173e09d8748658c59785da86438a7189
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-12-12 08:17:58 +00:00
Eike Ziller
508a9bdb24 Move line/column label functionality into single place
Create a LineColumnLabel class that aggregates the functionality that
was before spread through the editor widget and factory classes.

Change-Id: I6ba316174b2f690a0b146bdd606c6f8ed985ec20
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-12-07 12:49:26 +00:00
Eike Ziller
9687593bce Rename LineColumnLabel
It is not only used for line and column.

Change-Id: I544244dbca0b9f084e45ff2d7e4f28f79d2cae09
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-12-07 12:49:15 +00:00
Eike Ziller
a2739f55ed Merge remote-tracking branch 'origin/4.5'
Change-Id: Ic7c16091268083c0426cf29f0691a7ee458f2bd9
2017-12-07 09:16:01 +01:00
David Schulz
d0bf2a4528 TextEditor: fix animate navigation within file
The calculation based on visible lines is not working as
expected when we have collapsed blocks. Using QPlainTextEdit
functions to get the correct target scroll bar value.

Task-number: QTCREATORBUG-19327
Change-Id: I0393fc94ba2a11caeaa77d6d87bc69c6c7de1bb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-12-01 07:58:43 +00:00
Ivan Donchevskii
8efb598e60 TextEditor: move Link class to separate header in Utils
Link is a common class and is used across the plugins.

Change-Id: Id92e47e1b8604316ca8b970804e57abaf404ec28
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-11-27 13:57:02 +00:00
David Schulz
c815d456ed TextEditor: Add option to display annotation between lines
Task-number: QTCREATORBUG-19181
Change-Id: I9b3957c678c08ca2f3ddf9cfa5ff272241547471
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-22 10:08:01 +00:00
David Schulz
2d437325b8 TextEditor: Restructure TextEditorWidget::extraAreaPaintEvent
Change-Id: I832168226bfe254f0540ca1a947bf16170494549
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-10-26 08:32:55 +00:00
Eike Ziller
7f626b1182 Merge remote-tracking branch 'origin/4.5'
Change-Id: Iceaa4ca40b5318744bde8a76c6d3ccca08df71bb
2017-10-25 16:07:21 +02:00
Eike Ziller
1a1681bbcc TextEditor: Work around linguist issues
lupdate has issues with resolving non-trivial uses of "using namespace"
(QTBUG-64007)
Move "using namespace" directive to a place where it is better handled
by lupdate.
Also use TextEditorWidget instead of *Private as the context.

Change-Id: I7d3bb8e1bc493196e47085827be31f97e0dce7b8
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-25 07:13:45 +00:00
Robert Loehning
289dbab200 TextEditor: Initialize PaintEventData::rightMargin
Change-Id: I64690e594cf20f073ba348f5896a8cf9da5260b8
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-10-23 13:35:40 +00:00
David Schulz
0c0c10b167 TextEditor: Fix block for visible row calculation
Take into account that a block can contain multiple visible rows.

Change-Id: Ifedeb113b3c1a6a374fa9418106e612c56559cba
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-23 10:58:18 +00:00
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