Commit Graph

268 Commits

Author SHA1 Message Date
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
Montel Laurent
158ab3316e Use QString::*Ref method
Change-Id: I63a10f274dd17e08b5b8a2577762cc9f7960b5af
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-04-21 12:04:38 +00:00
hjk
3f5caf4cdc Utils: Wrap MimeDatabase into static functions
To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra
all over the place.

Change-Id: I4bfef62e73275a991455141671d6071162788e9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-03 07:57:54 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Orgad Shaneh
680ad97b12 TextEditor: Use member initialization for TextEditorWidgetPrivate
Change-Id: I7b13297532e3a949e9f14b3effce8bbb2d98ace1
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-16 07:06:30 +00:00
Eike Ziller
b1f1ccb32e Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/plugins/android/androidbuildapkstep.cpp
	src/plugins/genericprojectmanager/genericproject.cpp

Change-Id: I3484b668f9323ed0c05de99f8dfed07c9e65ab98
2017-01-11 09:29:37 +01:00
David Schulz
f3e3d395e5 Editor: Fix '.' completion trigger behavior
This is a partial revert of c7f19dc0a6.

Change-Id: I09998c5bc82c29a348dfd6ba4a9a14c1ce52422b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-05 12:46:39 +00:00
David Schulz
e7ffd1eefc Editor: Avoid setting text cursor when clearing block selection
Task-number: QTCREATORBUG-17475
Change-Id: I0266530c8c2ba10bd14dcb26b946cc51a825600f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-01-03 10:06:02 +00:00
Tobias Hunger
c7f19dc0a6 TextEditorWidget: Simplify code
* Prevent potential nullptr access while at it.

Change-Id: Icee9e711b8a09b11e5644b0643d4751909b96101
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-06 10:18:43 +00:00
Jarek Kobus
2c6adc1e74 VCS: Replace QToolButtons in VCS toolbar with QActions
Change VcsBaseEditorParameterWidget to add actions/widgets to an
existing toolbar, instead of being a widget itself.

The class is renamed in a follow-up commit.

Task-number: QTCREATORBUG-14934
Change-Id: I473a439d12a096f4cbb64f06faa0598ee72000de
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2016-10-24 16:23:33 +00:00
Michal Steller
768eb4e52e TextEditor: Duplicate selection (Duplicate selection and comment)
New TextEditor action for duplicating current selection.
Extended version of this feature creates commented duplications.

Possible use cases:
1. No selection, cursor anywhere in text - Duplicity line
2. Simple selection - Duplicity selection
3. Block selection, without columns - Duplicity lines
4. Block selection, with columns - Duplicity selection

Cursor position and selection stays unchanged. Works well with Undo
action.

First use case with no selection looks similar as copyLineDown, but
difference is that copyLineDown moves current cursor position and select
created line. This feature don't change cursor position. Because of this
difference it is not possible to integrate this additions with
copyLineDown.

Quick intro: https://youtu.be/Fv6WdCnCLpo

Change-Id: I7c36fca6e17de030cbd22cfa103c2ed672deabbc
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-21 10:00:10 +00:00
Nikolai Kosjar
dd647b4236 CppEditor: Clean up header error indicator
* Show/hide the error indicator button instead of enabling/disabling it.
* Use "Minimize" instead of "Do Not Show Again" in the info bar button
  and use a custom setting to save this. The current info bar API does
  not signal addition/removal of global suppression ids which would be
  needed to update all editor widgets properly. We are the only client
  and it feels wrong to add this API there at the moment.
* Remove not needed code anymore.

Change-Id: I2bb872522b7410434f060cc359a3b62dfed0af4d
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-14 09:01:17 +00:00
Jarek Kobus
a2ec71b30a Remove some ancient, dead, test code
Change-Id: Id252fbddd90c2ca3658318c3f256d3a7a0016cef
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-10-07 07:15:42 +00:00
David Schulz
50a6c47830 Use icons and default tool tips in text mark popup
Change-Id: I4487d642e066479e8e344ed77e539de92fbca651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-09-06 09:12:36 +00:00
Tobias Hunger
90a235e380 TextEditor: Code cosmetics
Change-Id: Ib08a8cd8867b977c22c2d96ad0a65b7d6d2fecf6
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-08-22 08:42:13 +00:00
Orgad Shaneh
6afcf33f7a TextEditor: Remove use of deprecated additionalFormats
Replace with formats

Change-Id: I9a24c0ad138c378aed1c49a15b80b7f64edabe30
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-08-10 06:12:10 +00:00
David Schulz
db0c289f02 Editor: Add action to select word under cursor
Task-number: QTCREATORBUG-641
Change-Id: I83e2705c7250646b13cd3ec52779a1496e6a472c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-08-02 07:29:15 +00:00
hjk
728b914727 CppEditor: Use full tooltip in ClangTextMark
Change-Id: I39cc64acbdbcd5e5156e1514acaf9674a91e81a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-07-25 13:25:16 +00:00
hjk
6edfb66908 TextEditor: Enable tooltips for textmarks
Adjust bookmark code, add tooltips for clang diagnostics.

Change-Id: I489d499f5431fcb29f27611d4350298acb30baac
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-07-19 10:45:23 +00:00
David Schulz
5a78fcb434 Editor: Restrict deletion of automatically inserted characters.
Remove automatically inserted characters only when the cursor wasn't
explicitly moved or the editor hasn't lost the focus after the
completion.

Change-Id: I9e995dc4ce79194b073b1bce3fa4dbc025a09a94
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-22 10:53:00 +00:00
David Schulz
6750607244 Editor: Skip auto completed character only if it was recently inserted.
This means you can skip automatically inserted characters as long as you
don't explicitly move the text cursor and the editor doesn't lose the
focus. This will be visualized by highlighting the automatically
inserted character as long as you can perform the skipping.

This will reduce unexpected skipping in the case a cursor was explicitly
placed before an closing brace and a closing brace is typed.

Change-Id: I28e29e79ba10c9c48e8bc8817405fea630cca9bd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-21 11:56:56 +00:00
David Schulz
c7b7e4d761 Editor: Use cursor instead of position for animations.
The cursor position is adjusted when the content of the editor changes
during the animation.

Change-Id: I6792841aca4babd6969a268c5b7cc318d7d4d4b1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-06-14 12:31:09 +00:00
Orgad Shaneh
517dd9ae43 TextEditor: Remove dead code
Change-Id: Id2211d3f1f34a25ce2d9dc466fbac46850a70f1e
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-13 05:08:41 +00:00
David Schulz
9bacb3e33e Editor: Highlight automatically inserted text
Keep the highlight as long as the cursor is directly behind the closing
character and the editor is the focus widget.

Change-Id: Ic1d4bac263e9d2f395791dad7ecdceb9d69635c5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-06-13 05:08:07 +00:00
Alessandro Portale
fd3d5d30d8 TextEditor: drawFoldingMarker fixes
- Correct marker position for QFusionStyle
- Don't repeat the "s->metaObject()->className()" call
- Re-use existing triangle drawing code for OxygenStyle

Change-Id: Ie203571a9053e115ab51ea9bdbf1b7376951e771
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-10 08:29:18 +00:00
Alessandro Portale
bc5071df93 TextEditor: Simplified "Collapse" rectangle
The original implementation had several issues with HighDPI.
Also, the gradient looked a bit dated in the now flatter UI.

Let's just fill a rectangle.

Change-Id: I80c3d5f1f8be89e81ea07113a691e69b01ec6272
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-06-10 08:29:00 +00:00
David Schulz
797dc11937 Editor: Skip auto completion when in overwrite mode.
Don't disable all aspects of the AutoCompleter, but just skip the auto
completion when text is inserted in overwrite mode.

Change-Id: I3f1e25882130817446c80623369ab882abaf915d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-06-06 06:34:28 +00:00
David Schulz
d21cd57e13 Editor: Animate automatic completed text.
This gives a clear hint that something has changed.
And gets the attention of the author in the case he didn't
expect some kind of automatic brace or quote completion.

Change-Id: I33e383db9a1e797ecb285a407e46671f41be7051
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-05-31 12:58:19 +00:00
Eike Ziller
2de7f3e723 Revert "TextEditorFactory use rvalue refs for creators"
This reverts commit 2be30c27ac.
The above patch puts limitations on the use of the API, while
being a questionable optimization. There is no reason why it
should not be possible to use lvalues for setting the various
creators. And MSVC2013 even thinks that actual functions
are lvalues for std::function objects.

Change-Id: Ia4daa7c3367b51bd613e1ff840f0ee617d36f54b
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-31 10:05:34 +00:00
David Schulz
c422b81316 Move completion settings page to TextEditor plugin.
Change-Id: I12b7828d23d599e5903237d0cc2a3c0440e1b07d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-05-30 07:15:03 +00:00
David Schulz
7595aaa227 Editor: Separate auto insert brace and quote magic.
To allow enabling/disabling both features separately.

Change-Id: Ica154e3b400823de7cf22daf006958802d751c64
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-05-25 13:55:50 +00:00
Eike Ziller
3d751dcf44 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	share/qtcreator/debugger/creatortypes.py
	src/plugins/beautifier/clangformat/clangformat.cpp

Change-Id: I1ab281c190767ced8a6ac2c026a121ea229a36cf
2016-05-11 13:28:35 +02:00
Anatoly Stolbov
d8e38131b7 TextEditor: printPage: add const to variables
Change-Id: I38959eb95b5d37d7e4936a5644af33b645e8da9f
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-05-11 10:33:05 +00:00
Eike Ziller
ee8bf341c6 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/projectexplorer/session.cpp
	src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp

Change-Id: I6946139f5e5fa3a9cdbb322fd50be248e2c0133f
2016-04-20 14:58:48 +02:00
Nikolai Kosjar
441d8d29a5 TextEditor: Emit markTooltipRequested only once per line
...otherwise the same tooltip will be created over and over again,
leading to a "moving tooltip widget".

Change-Id: I1704bc34c458ebe1aec664d5295418ab1d2b5082
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-04-15 14:55:20 +00:00
Eike Ziller
5c87432260 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp

Change-Id: I6ae2d37290643d69390f679a54f7596782f3d97f
2016-04-12 11:34:46 +02:00
David Schulz
6bad4bf5c6 Editor: Simplify cursor in snippet check.
Change-Id: I7f2c6a411122d83a118b22814acf50bb0b66d95e
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2016-04-06 05:25:57 +00:00
David Schulz
aa2c1cc51a Fix crash caused by invalid text document layout.
Task-number: QTCREATORBUG-15955
Change-Id: I917bf0cc8921fe9dd40f8f58894a5c72e80441ed
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2016-04-05 13:45:07 +00:00
Alexandru Croitor
bed88818ce C++: Implement context-aware expand / shrink selection actions.
Implement selection expanding / shrinking, that is aware of C++
semantics, thus giving smart selection changing.

Change-Id: I1386a20597fa6bb85c3aa0d8ddfb87cdb3fd7c38
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2016-02-29 08:15:03 +00:00
David Schulz
9aa51d4857 Editor: Fix whitespace cleaning.
Task-number: QTCREATORBUG-7994
Change-Id: I6c197ccc3a148555018e8f8184d116c88d7ea400
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-24 12:03:12 +00:00
Alexandru Croitor
2a00686c7e TextEditor: Make copyLine action actually select the line.
Change-Id: Ibaeed5997b92b5bbe933dd8123e433fcf197e4fe
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-02-19 13:03:59 +00:00
Eike Ziller
5952165cf9 Merge remote-tracking branch 'origin/3.6'
Change-Id: Ic4d3d94feaaa588c6244509bb3dd14c5cb646fe7
2016-02-01 16:15:48 +01:00
hjk
677effda78 Remove even more uses of deprecated typedefs
Change-Id: Icb48d484f760eb11ef2d41d8271e43f4f51c2e91
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 13:23:53 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Marc Reilly
64b172ae73 hoverhandler: add priority system to determine which tooltip is shown
Hover handlers now have a priority which is used to determine which
handler's tooltip is shown. The handler with the highest priority is
used, or, in the case of equal rankings, the first registered handler.

The base handler implements a default basic priority system based on the
diagnostic and help properties. Derived handlers can manually set the
ranking value as part of the identifyMatch() call.

A new checkToolTip() method is added so the handler can analyze whether a
tooltip is valid without it being shown.

Change-Id: I9d82fb9cc52f1d3cd53a8b197d75cd923651b79d
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-01-18 09:25:03 +00:00
Orgad Shaneh
3f46e3da30 TextEditor: Make TextEditorSettings all static
Move the fading indicator to the widget

Change-Id: I762c46845153c93c75ea0198c993b655559fad3b
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-12-18 12:01:59 +00:00