Use nullptr, do explicit double/float/int conversions, use constFirst.
Change-Id: I269718ade5c54ac613357f59c774e2f47e18a9df
Reviewed-by: David Schulz <david.schulz@qt.io>
For this make the default context menu for the text editor extensible
and add the context help item from the help plugin, which now has an
optional dependency on the text editor to ensure correct loading order
if both are present.
Task-number: QTCREATORBUG-55
Change-Id: I378a491ba3700e65fc262bdb10c8ead5ad62cb33
Reviewed-by: David Schulz <david.schulz@qt.io>
Text editor implementations that did not do anything special with
invoking their context menu, including our plain text editor, only had
Qt's default context menu, without Qt Creator's clipboard history and
BOM actions.
Make the default actions in our custom context menu more similar to Qt's
default actions by adding Undo, Redo and Select All, and not hiding
disabled actions, and use that by default in all text editor
implementations.
Change-Id: Idd5fb276dcd652223d96536dacde8110f9eb576f
Reviewed-by: David Schulz <david.schulz@qt.io>
processEvents is a bad way of dealing with asynchronous
requests. Use QFutureWatcher for that purpose.
Change-Id: I3839cb9db80a6d391f6af1178e96986a325b7b99
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Directly after triggering the snippet completion, a funny input method
event is sent that doesn't contain any data. This still results in a
even more funny contentsChanged signal from QPlainTextEdit which made
our text editor think that the document has changed somewhere else. In
which case we close the snippet variable input.
So ignore funny input method events.
Task-number: QTCREATORBUG-19571
Change-Id: I3958e8736b1b3e3dea5225356ee4cd173d6beaa0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Emit documentSizeChanged after resizing the block boundaries because of
an annotation between lines.
Task-number: QTCREATORBUG-19790
Change-Id: If468ec003a43f37fdcb182344992e4094b269c92
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Take block bounding rects into account, when calculating the row count
or the center visible line.
Change-Id: If933828867df25920eeb56359e9a42a8b95d9c6d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Add completion based on words of the document. This provides basic
assistance for programming languages without a code model.
Task-number: QTCREATORBUG-13869
Change-Id: I3a9c59c741dfd6895442fc0524cfd1bd3b2b0111
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Apply some clazy and modernize fixes from clang tidy: mostly use of
nullptr and removal of type duplication.
Change-Id: Ibd9ee8f9b8a836a40d6f9be0b95acc91513a1a01
Reviewed-by: David Schulz <david.schulz@qt.io>
For the tool tip it moves the position to the start of the word before
passing it to the hoverhandler. That wasn't the case if the user
requests context help, which lead to the strange situation that the tool
tip showed help, but context help at the same position did not (e.g. on
QApplication::topLevelWidgets() with the cursor between the
parentheses).
Related to QTCREATORBUG-15959
Change-Id: I2b9918ea235869c2ddeeba6e749958c10a47d259
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
...in case the current run is not yet finished.
Change-Id: Id78db576ad8fad10af6b21c73e5b47b49d58d26b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
...to support asynchronous hover handlers like ClangHoverHandler.
Change-Id: I8dc7189db37ec3a923cf493b8957c59ec9be447c
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
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>
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>
Link is a common class and is used across the plugins.
Change-Id: Id92e47e1b8604316ca8b970804e57abaf404ec28
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
Take into account that a block can contain multiple visible rows.
Change-Id: Ifedeb113b3c1a6a374fa9418106e612c56559cba
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Splitting the paintEvent method into various sub routines to increase
the maintainability.
Change-Id: I4aa7a52aa6e20279654784b55f92053d6ede00be
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
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>
Width is not zero-based.
Task-number: QTCREATORBUG-19091
Change-Id: I32134727bed204f6bb10748cd067a775f673b89b
Reviewed-by: David Schulz <david.schulz@qt.io>
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>
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>
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>
Allows to use this header without texteditor dependency.
Change-Id: I706f42799c3ea42473a716fa9ef9f3cfbef6fdd4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>