aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextedit_p_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add a way to set the default render type of text-like elementsGiuseppe D'Angelo2017-08-231-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | f3446071da8357620d0c8593a04e3b4fbba88f21 introduced a build-time way to select the default render type of text-like elements. This patch adds also a way to select it at runtime, via a setter on QQuickWindow. (QQuickWindow has been chosen as convenience, rather than adding another namespace/class to just have this setter.) Given that QT_QUICK_DEFAULT_TEXT_RENDER_TYPE was never documented, I've taken the liberty of changing the accepted values for it (to match the new enumerator names in QQuickWindow, rather than the ones in QQuickText/QQuickTextEdit/etc.). [ChangeLog][QtQuick][QQuickWindow] It is now possible to set the default render type of text-like elements globally via the QQuickWindow::setTextRenderType() function. If you were using the (undocumented) QT_QUICK_DEFAULT_TEXT_RENDER_TYPE macro when building Qt Quick for the same purpose, note that the macro value needs now to be set to the "NativeTextRendering" value, instead of "NativeRendering". Change-Id: Id4b2dc3ec823971486e445ca4173b8be848fb4e3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-3/+3
| | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QQuickTextEdit: added clear() methodLiang Qi2016-01-191-0/+1
| | | | | | Task-number: QTBUG-50428 Change-Id: Id618616f8d8d50c2a2eba79a2bf6969662e727b8 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+4
|\ | | | | | | Change-Id: I11ea57222ba5aa683b7bfd7735fbc1d2cf86e875
| * QQuickTextEdit/Input: revise implicit resizing - take twoJ-P Nurmi2015-10-041-6/+2
| | | | | | | | | | | | | | | | Referencing unexported symbols (ExtraData) from an inlined method does not work with MinGW. Change-Id: I19935c84c4e2014f73bcd1801d182d193166bd44 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
| * QQuickTextEdit/Input: revise implicit resizingJ-P Nurmi2015-10-031-1/+8
| | | | | | | | | | | | | | | | | | | | Rename explicitImplicitSize to better descriptive implicitResize, and add a method to disable the default behavior. QQuickTextField was unable to access the flag directly, because ExtraData is not exported (and we prefer to keep it that way). Change-Id: Ia8b8281267adfc376e03a14882708e9cf80f0451 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* | Add a way to set default font rendering at build time.Stephen Kelly2015-10-131-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QML text rendering elements have a renderType property controlling whether to use 'Qt' rendering or 'Native' rendering. There is no reason to mix different types of rendering in one static ui. The element-local properties may be used to change the rendering type during animation for example, but otherwise there should be an application-wide rendering mode for text. That means that all Text-based elements in QML should default to the same rendering mode. Additionally, applications wishing to use NativeRendering, wish to use it for all text-based elements, so they require changing the defaults of the elements themselves, still allowing the possibility of changing the rendering mode during animation. Creating third party wrappers for each of the QML text rendering types is not a solution because an application requires the same font rendering for all text. That is, whether written directly with QML Text* elements, or using QtQuick controls, or another 3rd party component set, it is necessary to set the same font rendering mode for all text, except in temporary execptional cases. The known options to achieve this are 1) Create an environment variable to set the default rendering. 2) Add C++ API to set the default 3) Add a build-time option to set the default. The first option is unsatisfying because it is fragile and is easy to get wrong. The second option is incomplete because it does not affect qmlscene etc, so it would require adding a command line argument to qmlscene to change the default. That is unsatisfying because it is also fragile. It is necessary for the sanity of developers and designers (and also end users) that qmlscene use the correct default by default. It must be easy to create qml files for designers to run with qmlscene and which look correct. The third option is the one chosen for this patch. It is most suitable for environments where the Qt build and settings are contained because a particular Qt build is shipped with the application using it (This is the most common way Qt is used). It affects all uses of the text rendering elements, whether used through qmlscene or through another entry point, and it allows changing the property in QML code away from the build-time-determined default. When building Qt, -DQT_QUICK_DEFAULT_TEXT_RENDER_TYPE=NativeRendering may be passed to configure to affect the default rendering for the Qt build. It also leaves the question why the default text rendering is 'Qt' instead of being 'Native', given that many of the Qt controls need to switch to Native anyway (though this depends on the platform and the style). Change-Id: Ib0eed61caf4895b29e5c05e0418fad9962779f85 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* TextInput & TextEdit: allow controls to override the implicit sizeJ-P Nurmi2015-09-061-0/+1
| | | | | | Change-Id: I4b5eae46a9fef574249eee9061858bdf874c54be Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* qquicktextedit_p_p.h: cleanup unneeded includeJ-P Nurmi2015-06-241-1/+0
| | | | | | | | | A forward declaration of QQuickTextControl is enough. This solves a linking error on Windows, when QQuickTextAreaPrivate inherits QQuickTextEditPrivate. Change-Id: I05a2fa5745e27eea51f7c0a5a0360c3fbb563544 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Export QQuickTextInputPrivate and QQuickTextEditPrivateJ-P Nurmi2015-06-231-1/+1
| | | | | | | ...so that QtQuick.Controls 2 TextField and TextArea can inherit them. Change-Id: I9383927c51a70848753a9f41f374d4161000fbb1 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* QQuickTextEdit: move paddings into extraDataLiang Qi2015-06-151-11/+18
| | | | | | Task-number: QTBUG-46529 Change-Id: I67b8125d160213121b30fbb44fa834609d668099 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* QQuickText: Don't store node engine per node.Robin Burchell2015-06-061-1/+2
| | | | | | | | | | | | | | | Since these are only used during one particular phase of dealing with text, it is extremely wasteful to heap allocate them and keep them around for the entire lifetime of the node (~3kb of total allocation _each_ according to OS X). Removing these cuts around 100mb of transient allocations off the qmlbench text creation benchmark (and takes the total allocations during a test run from ~496 MB to ~389 MB). It also improves the approximate throughput for creation of text items by ~5%. Change-Id: I45c8a50879ed545da1fb13ab3c2c5d857b112cf7 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* TextEdit: add support for paddingJ-P Nurmi2015-03-051-1/+17
| | | | | | | | | | | | | This makes it possible for TextArea to inherit TextEdit, reserve space for the decoration, and set the desired property defaults without having to create dozens of property aliases. [ChangeLog][QtQuick][TextEdit] Added padding, leftPadding, topPadding, rightPadding and bottomPadding properties. Task-number: QTBUG-41559 Change-Id: I4fa22f86e6151524a63b2b862f17bc9d6a713142 Reviewed-by: Alan Alpert <aalpert@blackberry.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>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-10-311-1/+1
|\ | | | | | | Change-Id: I30f9c925631991ceb22339d1333936faecffbaf4
| * text input: always let cursor rect have a width == 1Richard Moe Gustavsen2014-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-111-20/+12
|\| | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickpainteditem.h src/quick/items/qquickshadereffectsource.cpp src/quick/items/qquickshadereffectsource_p.h Change-Id: If98096443afe85fc4370cef971eace050006a61b
| * 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>
| * Create rectangle nodes in the text editing through the contextLars Knoll2014-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | Unfortunately we can't re-use the QSGSimpleRectNode, as it doesn't provide us with virtual methods to move it's creation into the context. But's since it's only 20 lines of code anyway, this is still a nice cleanup. And it also allows the re-use of any optimizations in the renderer for QSGRectangleNode. Change-Id: I957777fbbeb0a994a9c257baf3bfe87fce8cc9e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add Q_DECL_OVERRIDEAlbert Astals Cid2014-08-141-2/+2
|/ | | | | Change-Id: I2e64950aef710f943c3bc50bc9bf8a1f7fb58d28 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Fix Node object leak in QQuickTextEditPrivateLiang Jian2014-07-231-0/+5
| | | | | | | Delete Node objects stored in textNodeMap at two places to prevent leak. Change-Id: I8eb0d1af900c94e1fab2f55b689de393e674f0aa Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* Fix license headers of QtQuick sources.Gunnar Sletta2013-09-301-1/+1
| | | | | Change-Id: I3750c47640bf21c3567c5fa1c4667e3e2552942e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-07-041-4/+1
|\ | | | | | | Change-Id: I15cb7460171b38d11d66367aeb0831ec6e3ca933
| * QQuickTextEdit: move QSG* members from dptr to root node.Pierre Rossi2013-07-031-4/+1
| | | | | | | | | | | | | | | | | | Subclass QSGTransform node for our use case and add the frame decorations and cursor nodes in there. Task-number: QTBUG-31580 Change-Id: Id2b468b53092f21134ae45e5694bc54c43660f8b Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* | Add QQuickTextEdit::hoveredLinkJ-P Nurmi2013-06-071-0/+1
|/ | | | | | Change-Id: I9d75a97c86e047742514f942cdb91c70f1d7a9a2 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* TextEdit: Better support of QTextTable and inline imagesPierre Rossi2013-04-301-0/+3
| | | | | | | | | | | | | | | | | | | | Fix some issues with incremental updates found while playing with the Quick Controls textedit demo. -Grouping text blocks into a single text node is fine as long as it doesn't cross the boundary of a child frame (e.g. a table), otherwise all that node logic collapses. -Text tables are hard to split in a sensible way, ensure we treat them as one text node for the sake of simplicity. -Inline images can cause several text nodes to have the same apparent start position. Beef up the rewinding logic in markDirtyNodesForRange. Change-Id: Ib4518bcd9303035fa00d9f4b16da7ca6c88e2313 Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Optimize QQuickTextEdit for larger documents.Pierre Rossi2013-03-201-3/+26
| | | | | | | | | | | | | | | | | 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>
* Add TextEdit::selectByKeyboardJ-P Nurmi2013-03-151-1/+3
| | | | | | | | | The main use case is for enabling text selection by keyboard for read-only editors. Change-Id: Ieaa9af366fd0eaf863a104a2fdf33c9ddad38b10 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Handle focus events directly in TextEdit.Frederik Gladhorn2013-03-071-0/+1
| | | | | | | | | Instead of relying on the item change where we don't get focus reason, use focusInEvent and focusOutEvent. Change-Id: I2db7d81c67c65595b929fdcedc568af360831c5c Reviewed-by: Caroline Chao <caroline.chao@digia.com>
* Enablers for input methods on AndroidPaul Olav Tvete2013-03-041-0/+4
| | | | | | Change-Id: Ic26722cf530e7a787e7a8f92b645e3c4883d9822 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add QQuickTextDocumentFrederik Gladhorn2013-02-191-0/+2
| | | | | | | | | | | | | Adding QQuickTextDocument as a way to access the QTextDocument of QQuickTextEdit from C++. This makes it possible to use a QSyntaxHighlighter from C++ without exposing more than one single qml property in the TextEdit. Change-Id: If1790b591493adcb0b68aef0c8ca706e00450657 Reviewed-by: Alan Alpert <aalpert@rim.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.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-1/+6
| | | | | | 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 horizontal alignment of unwrapped text in TextEdit.Andrew den Exter2012-07-161-1/+2
| | | | | | | | | | When the actual width of the text in a QTextDocument exceeds the specificed textWidth it is aligned left irregardless of the text alignment. Compensate by doing our own alignment of the laid out document. Change-Id: I7df900316ffb3ecdf01ddb053480a60a8258182d Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add option to use native rasterizer for SceneGraph textEskil Abrahamsen Blomfeldt2012-07-101-0/+2
| | | | | | | | | | For old-style (desktop components) apps using QML 2 on regular density displays, distance field text will look out of place. We introduce an option to use the native rasterizer instead if you would rather have native look and feel than scalable text items. Change-Id: Idb38e3c89f2deab9ae1963357c6c5fb235ddeab8 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* Speed up TextEdit construction time.Andrew den Exter2012-07-091-1/+1
| | | | | | | | | | | | 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>
* Defer construction of TextEdit/TextInput delegates.Andrew den Exter2012-05-141-4/+10
| | | | | | | | | | | | | | | Don't create instances of the delegate components until the item gains focus, or the cursorVisible property is set to true. Cursor delegates are typically small and relatively fast to create and so won't have a significant cost during a one off focus in event, but that cost can still add up when creating a number of TextInputs or TextEdits at once. If a delegate that is instantiated immeditately is required it is possible to instead create a child item and bind to the cursorRectangle and cursorVisible properties. Change-Id: I5ec2b5b6a30e534aee3dd5a58c6a5ac0686f5ce2 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* TextEdit to honor input direction on neutral textPekka Vuorela2012-04-271-2/+4
| | | | | | | | Text with neutral direction, such as e.g. plain spaces, do not need to make text left aligned on arabic input method. Change-Id: I9aab5244ec47cf80fb2ba0f83e7087430eb2c7bb Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
* Fix text wrapping and eliding with implicitWidth.Andrew den Exter2012-03-221-1/+2
| | | | | | | | | | | | Update the implicitWidth of the item before continuing with the layout rather than after it's completed this gives any bindings dependent on the implicitWidth the opportunity to update the width before the layout continues. Task-number: QTBUG-22680 Task-number: QTBUG-24251 Change-Id: I61cd96ad9891b22d8b83937ad2c06719f88976b6 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Merge master <-> api_changesMatthew Vogt2012-03-051-37/+42
|\ | | | | | | Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
| * Use floating point types for position offsets and cursorRectangle.Andrew den Exter2012-02-241-4/+4
| | | | | | | | | | | | | | | | | | Rounding to align painting to pixel boundaries is no longer necessary are largely removed. Correct the few instances remaining in TextEdit and TextInput. Change-Id: Ic6ec57092d74ec43b23d85cd8868e0190acc3e09 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
| * Reduce QQuickTextEdit memory usage.Andrew den Exter2012-02-231-37/+42
| | | | | | | | | | | | | | | | | | 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>
* | Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-3/+3
|/ | | | | | | | | | | | | Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove commit headersAaron Kennedy2012-02-201-1/+0
| | | | | | | | These were used when we were porting from QtQuick 1 to QtQuick 2 but are no longer necessary. Change-Id: I0eeb7e13b4affdd6ab6c6dddea760afcdf38ee4f Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Have input method hints on only classes using themPekka Vuorela2012-02-171-1/+2
| | | | | | | | | | | Removed inputMethodHints setter and getter from QQuickItem. No need to consume memory for input method hints on every item when only QQuickTextInput and QQuickTextEdit actually use them. Additionally introduced change signals on the editor hint properties. Change-Id: Ice380d4f4dd47fdde73d2468f4a44a7d1540ad45 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Remove pixmap text caching in TextEdit elementYann Bodson2012-02-151-13/+2
| | | | | | | Task-number: QTBUG-24278 Change-Id: Ida9014aceba93c023c88538969dff7e72ef5a6d8 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
* Add contentWidth and contentHeight properties to Text elements.Andrew den Exter2012-02-071-1/+1
| | | | | | | | | | | For Text and TextEdit this is a rename of paintedWidth and paintedHeight both of which remain as synonyms of the content properties for compatability. For TextInput this is a new property. Task-number: QTBUG-23691 Task-number: QTBUG-15160 Change-Id: Idbdc72fad34922be21b649ca45fc39b5e533ed1a Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Add a persistentSelection property to TextInput.Andrew den Exter2012-02-021-1/+1
| | | | | | | | Improves feature parity with TextEdit. Task-number: QTBUG-16355 Change-Id: I3919c71454a4f4574a1ee35ad38969459beb8363 Reviewed-by: Martin Jones <martin.jones@nokia.com>