aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextcontrol.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use QStringRef in a bunch of places.wip/dbusSérgio Martins2015-10-181-1/+1
| | | | | | | Done automatically with clazy static analyzer. Change-Id: Ia0cf8fa24331ab102a3c3c30c2aa92ef1ba772e2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* TextEdit: selectedTextChanged not emitted when calling select 2nd timeDan Cape2015-09-211-4/+14
| | | | | | | | | | | | | | | | | | | | | | | qquicktextcontrol was only checking if the text was previous selected or not and if the current state matched the previous state it would not dispatch a selectedTextChanged event. This is wrong if you programmatically select text a second time with a different start or end of selection. You must notify that the selected text changed since visually you can see the highlight changed locations. When correcting this and creating a test case, it was seen that other tests had QEXPECT_FAIL set for this specific case. Upon further inspection, I could remove those calls and adjust the expected data that was set before the test (changing false to true). testing of tst_qquicktext: Totals: 182 passed, 0 failed, 0 skipped, 0 blacklisted testing of tst_qquicktextedit: Totals: 354 passed, 0 failed, 3 skipped, 0 blacklisted Task-number: QTBUG-38704 Change-Id: Ib5244dc264ab76951bb722a31dcb64717282725a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * Doc: replace Mac OS X with OS XNico Vertriest2015-07-151-1/+1
| | | | | | | | | | | | Task-number: QTBUG-40759 Change-Id: If21b4551eb95af3370cc21edd7a6721fc06e1346 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Fix users of QTextLayout::additionalFormats to use the new APIMarc Mutz2015-06-051-2/+2
|/ | | | | | | | | QTextLayout::additionalFormats setters and getters using QList<FormatRange> have been deprecated; port to the QVector versions. Change-Id: I6702430c09b30aa033fe4e34f39a9aa3350e471b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix invocations of static methods of QGuiApplication/QCoreApplication.Friedemann Kleint2015-03-051-7/+7
| | | | | Change-Id: I7bcc209b0c6e77cf6d974af85a19487345a48975 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* text input: always let cursor rect have a width == 1Richard Moe Gustavsen2014-10-301-26/+2
| | | | | | | | | | | | | | | | Instead of using a cursor width of null when a cursor delegate is set, we should to use a value of 1. Otherwise the rect we e.g return from cursorRect() will be invalid. An alternative would be to use the width of the delegate, but that was found to be controversial. On iOS we saw a bug with this when telling iOS to position text spelling popups underneath the cursor. Since the cursor rect we got was invalid (zero-width), no popup would show. Change-Id: Ice51b9a1bd33f331183e3acec61b7d9c0f5163cd Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* QQuickTextControl: update cursor rect when cursor changes positionRichard Moe Gustavsen2014-09-161-3/+3
| | | | | | | | | | | | | | If the text cursor changes position by indirect manipulation of the document that backs a QQuickTextControl, we need to inform that the cursor rect changed as well. This will fix a bug with QQuickTextEdit that caused the platform input method to be out of sync since the cursor rect signal was never emitted from the the text control. Task-number: QTBUG-41042 Change-Id: Idcf35a2d51c8dffcb80ba21f8e59a61e04e5a879 Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* TextEdit: fix cursor rectangle positioningJ-P Nurmi2014-05-161-2/+5
| | | | | | | | | | | QQuickTextControl::cursorRectangleChanged() wasn't emitted as appropriate when dragging mouse => The cursor delegate was stuck in wrong position under certain circumstances, especially when selecting multiple lines. Task-number: QTBUG-38947 Change-Id: Ib5b0d2f6ea2a1b3712fbaba4a7ad1865d2b0a74e Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Implement the new inputmethod query API for Qt QuickPaul Olav Tvete2014-04-221-0/+46
| | | | | | | | | Part fixing Android input methods. This change corresponds to 68a9229a97d358639 in the qtbase repository. Task-number: QTBUG-37511 Change-Id: I483abf6a9d5dec86dbd1ae2dff2a85bc19d126f1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Remove variables that aren't being used right nowThiago Macieira2013-09-071-1/+0
| | | | | | | | | | | | | Found by ICC. src/quick/items/qquicktextcontrol.cpp(78): error #2415: variable "fullWidthSelection" of static storage duration was declared but never referenced src/quick/items/qquicktextinput.cpp(2696): error #2415: variable "textCursorWidth" of static storage duration was declared but never referenced src/quick/items/qquicktextinput.cpp(2697): error #2415: variable "fullWidthSelection" of static storage duration was declared but never referenced src/quick/scenegraph/qsgthreadedrenderloop.cpp(164): error #2415: variable "WM_LockAndSync" of static storage duration was declared but never referenced src/quick/scenegraph/qsgthreadedrenderloop.cpp(181): error #2415: variable "WM_UpdateLater" of static storage duration was declared but never referenced Change-Id: I60b5cce79d7be5f909b690f97ffa93ea00d3c044 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Add QQuickTextEdit::hoveredLinkJ-P Nurmi2013-06-071-0/+26
| | | | | | Change-Id: I9d75a97c86e047742514f942cdb91c70f1d7a9a2 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* QQuickTextControl: emit cursorPositionChanged() only if it changedJ-P Nurmi2013-05-221-1/+4
| | | | | | Change-Id: Id6fe03677e93119a63bfe87ade3cd333bf4890a1 Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Don't eat Back button in TextEditPaul Olav Tvete2013-04-301-0/+19
| | | | | | | | | | | | On Android, Key_Back is used to change to the previous state in-app, as well as to exit the application. QTextControl does not react to the back button, so it should not accept the event. Task-number: QTBUG-30752 Change-Id: I010d36c93f14384b96fb0b2f0015c57a2a3d2497 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Optimize QQuickTextEdit for larger documents.Pierre Rossi2013-03-201-0/+1
| | | | | | | | | | | | | | | | | The rationale is to not end up re-processing the whole document on each update Since we know where the editing takes place, we can break down the text edit's contents in several text nodes and only re-create the affected text nodes upon editing. This requires ripping out the SelectionEngine helper class from QQuickTextNode so that QQuickTextEdit can tap into its functionality directly. A positive side-effect of this exercise is that it should be much harder to to come across GlyphNodes packing more than 16300 glyphs or so. Task-number: QTBUG-29596 Change-Id: Id29b0709baa43f5b29c44ab02398ba996be3e28a Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Typos: tripple->tripleFrederik Gladhorn2013-02-211-18/+18
| | | | | | | This enables grepping. Change-Id: Ibf85800b998a02645c50b1b84d42088d16091378 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Enable module build with QT_NO_IMTasuku Suzuki2012-11-261-0/+28
| | | | | | Change-Id: I90f8ec7e6357db7b4038bb1646fe9d3835821556 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Alan Alpert (RIM) <aalpert@rim.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix pasting with the middle button in TextInput and TextEdit.Andrew den Exter2012-08-061-2/+4
| | | | | | | | Neither item accepted the middle button which prevented the mouse events ever reaching them. Change-Id: Ia8f693099df4d6c248976453d554fef96d1d3b33 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove code for unused LinksAccessibleByKeyboard option.Andrew den Exter2012-07-111-8/+0
| | | | | | | | The text interaction flags aren't exposed publicly and the option isn't set by TextEdit itself so there's no need to handle it. Change-Id: I83b98e58e3b8cb8c55752d8eefe3bf36bff75249 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Speed up TextEdit construction time.Andrew den Exter2012-07-091-51/+26
| | | | | | | | | | | | Defer setting content on the QTextDocument until componentComplete() to avoid unnecessary layouts and move one time setup for the text document from setContent to the constructor. Reduces the construction time of a TextEdit with RichText textFormat by about a third. Change-Id: Idde0772063bf769cde984efddd68589c55a7431a Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Don't calculate selection rects unnecessarily.Andrew den Exter2012-07-041-101/+9
| | | | | | | | QQuickTextEdit ignores the updateRequest QRect arguments, so don't bother calculating them. Change-Id: Icb9126ab799c6b216eb0c4b9e3ff3f6a4bf8f03c Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove dead code from QQuickTextControl.Andrew den Exter2012-07-041-70/+0
| | | | | | | | Either unused functions, or code paths for signals that aren't connected to anything. Change-Id: Ide24f1263d05f93917a16a3c17cb06a619cd3421 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Avoid string-based lookup of signalsKent Hansen2012-06-011-2/+3
| | | | | Change-Id: I5b83b5d07b6a5d2de86d0f37471cf59baa7b0e43 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Ensure the cursor rectangle is updated when preedit text changes.Andrew den Exter2012-05-031-1/+1
| | | | | | | | | Updating only when the cursor position changes isn't enough because changing pre-edit text changes the width of the pre-edit area and the x offset of all cursor positions within it. Change-Id: I3c0a5e4ad4714a903ca84c1a25374491f34d95a0 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Fix TextEdit with right aligned text when size changesPekka Vuorela2012-04-271-9/+5
| | | | | | | | | | | Geometry change was avoiding updating size of the QTextDocument, thus it was not able to right align before something else triggered size change, e.g. a modification to the text. Also removed unnecessary cursorRectangleChanged signal that was emitted when moving focus with mouse. Change-Id: I293fd5119473eb3def5acd1b3fbb951c12e14412 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
* Ensure the cursor delegate position is correct when wrapping.Andrew den Exter2012-04-191-20/+27
| | | | | | | | | | When inserting text into a TextEdit with implicit width and wrapping the cursor delegate position has to be updated after the width is expanded to the implicit width otherwise it will be positioned in a wrapped location. Change-Id: Ibcb709ec1b4f6827ea8ae919f2e0c932c7372869 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* QQuickTextEdit to trigger input method updates on selectAll()Pekka Vuorela2012-04-121-5/+8
| | | | | | Change-Id: I8642eca0e584b811308b73817e7decf2f392f1b5 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
* Set cursorVisible to false when im cursor length is 0.Andrew den Exter2012-04-021-13/+61
| | | | | | | | | | | | If the length of the QInputMethodEvent::Cursor attribute is 0 the cursor is supposed to be hidden. To ensure this and any other IM state is reverted when the input method is reset send a empty event to the editor when preedit is cancelled or removed and count formatting or cursor changes when determining if the input method is composing (i.e has state that needs to be reset). Change-Id: Ifca69aa0c18776b1aef355ed6ae9aecc40b9d475 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Remove tentative commit from editorsPekka Vuorela2012-03-261-14/+5
| | | | | | | | | Feature to be reimplemented simplified. Now using new FocusAboutToChange event for using input method to commit stuff when window is losing focus. Change-Id: I81c96c36d9f0a1b38adb4324f3b892c33547cb50 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Make TextEdit word selection behaviour consistent.Andrew den Exter2012-03-201-22/+5
| | | | | | | | | | | | | Word selection initiated by a double click in QTextEdit only selects a word if the drag point is closer to the end than the start (assuming ltr selection) which can make it difficult to select small words with touch input, as such the SelectWords mouseSelectionMode of TextEdit selected a word if the drag point intersected any part of the word. Since we no longer have to retain compability for QTextEdit we can settle on a single behaviour for word selection. Change-Id: Iaabb7938a2b61b84a290a9ee41e407c83144b96f Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Remove unused functions from QQuickTextControl.Andrew den Exter2012-03-201-100/+0
| | | | | Change-Id: I036a2c2ff05cd94a7c58e29bf8743fef3a550fbd Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Reduce QQuickTextEdit memory usage.Andrew den Exter2012-02-231-86/+8
| | | | | | | | | Remove unnecessary members from QQuickTextEditPrivate and QQuickTextControlPrivate and re-order and pack to reduce padding for alignment. Change-Id: I14f5e3fc01646d02745f095c2a4b168cd675745d Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Use QInputMethod instead of deprecated QInputPanelPekka Vuorela2012-02-101-4/+4
| | | | | | | | | | Similarly deprecate Qt.application.inputPanel and introduce replacement Qt.inputMethod. Change-Id: Ie4fd467f93f75023c86b0a2d038d858fe5001146 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Sami Kananoja <sami.kananoja@nokia.com>
* Add a persistentSelection property to TextInput.Andrew den Exter2012-02-021-1/+2
| | | | | | | | Improves feature parity with TextEdit. Task-number: QTBUG-16355 Change-Id: I3919c71454a4f4574a1ee35ad38969459beb8363 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-231-1/+1
| | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Avoid creating unnecessary copies of TextEdit's text data.Andrew den Exter2012-01-161-1/+1
| | | | | | | | Delay rebuilding the text data from QTextDocument until it is actually requested rather than everytime the contents of the document change. Change-Id: Ibfdc9e9e0372010f0731fb02a223c8b59a67f2c3 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add undo and redo functions to TextInput and TextEdit.Andrew den Exter2012-01-121-6/+0
| | | | | | | | | The functionality already existed and was usable through keyboard short cuts but was not accessible through API. Task-number: QTBUG-16191 Change-Id: I080fa2ddb76668a7a632aa7477004f99037ea68b Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Delay initializing the canPaste property until it's requested.Andrew den Exter2011-12-211-2/+2
| | | | | | | | | | With xcb querying data from the clipboard can take as long as 50 ms. Deferring the check until it is requested speeds up construction time when it's not used and only checking the available formats when it is requested should also help. Change-Id: I796fc83d0457d9ac1490cfb9f510c6342eb8a872 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Activate links in a read only TextEdit.Andrew den Exter2011-12-151-3/+6
| | | | | | | | | Don't ignore mouse press events if the LinksAccessibleByMouse interaction flag is set. Task-number: QTBUG-23065 Change-Id: I25b3e3b0cf194b71fc863ed239196a567f42c19c Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove QQuickTextControl::ensureCursorVisible()Andrew den Exter2011-12-151-32/+18
| | | | | | | | | | | | QQuickTextEdit doesn't implement scrolling internally and QML code will use the cursorRectangle property to determine if it should scroll. All instances of ensureCursorVisible() have been replaced by cursorRectangleChanged() which was previously microFocusChanged(). Task-number: QTBUG-22627 Change-Id: I5df9e1d1cb4a8553eabd417a658e80da1c27e10c Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove unused code from QQuickTextControl.Andrew den Exter2011-12-151-885/+31
| | | | | | | | | | | QTextControl included a lot of functionality that was unused by TextEdit. Anything that is unused and therefore untested should go. Task-number: QTBUG-22627 Change-Id: Ie68b279cb8618bec0af76287c7c4db34d0642a0a Reviewed-by: Martin Jones <martin.jones@nokia.com>
* QQuickTextControl - mouse events to override input contextPekka Vuorela2011-12-141-116/+141
| | | | | | | | | | | | | | - Selection can start on top of preedit - Mouse press outside preedit commits - Double click to commit on top of preedit - Focus out to commit preedit Similar to qtbase 4b3d88a9c67402b6a234d597bab25846f039bbdb and b5c37d9e137dee2754335e83b8437dfd0e6cc7e7 for QTextEdit Change-Id: Ib9c37528ba7fd588ee993b7ff33f79f96857e421 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
* Protect QTextControl::setTextCursor for existing preeditPekka Vuorela2011-12-141-0/+1
| | | | | | Change-Id: I29fc7c472a3a20eeaf74e0dc411313e5750e9dee Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
* TextEdits to include tentative commit in text propertyPekka Vuorela2011-12-141-0/+19
| | | | | | | | | | Similar to what qtbase 1dbfbf4c66187e7522888c19d78024cfceaea570 did for QTextEdit. Now available only in plain text, html support pending. Change-Id: I0b23a45fc484512d3354f66e1a6134e2d70eb8b5 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>