aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextedit.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* QtQuick: Fix conflicting definition of ProtectedLayoutAccessor in CMake ↵Friedemann Kleint2023-02-031-10/+1
| | | | | | | | | | | | Unity (Jumbo) builds Move it to qquicktextdocument_p.h in namespace QtPrivate. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I7b0482e0dc052dc431c1264ff27423957d20b219 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use the right list-element type in documentationThibaut Cuvelier2022-11-051-15/+15
| | | | | | | | | | | | | The previous type, \value, did not parse correctly (missing Atom::ListLeft). The rendering in HTML, for instance, is also wrong: compare https://doc.qt.io/qt-6/qml-qtquick-textedit.html#font.hintingPreference-prop (\value) with https://doc.qt.io/qt-6/qml-qtquick-textedit.html#font.capitalization-prop (\li). Change-Id: If13ab920dce918aa56e31eb4b00a32a97d1de01f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* TextEdit: deal with scrolling backwards in plain textShawn Rutledge2022-10-211-2/+5
| | | | | | | | | | | | | | | | | | When the user scrolls backwards, we have a backwards iteration loop to find the block that is at or above the top of the viewport. But if the user tried to jump-scroll by some distance, boundingRect() and nodeOffset were staying constant, so the iteration tended to go all the way back to the first block. We need to update nodeOffset at each step. Also make test failures in largeTextObservesViewport() somewhat easier to troubleshoot. Amends cd083920b3b4f3a1ed7f2297058cf0d110d7cf10 Pick-to: 6.4 Fixes: QTBUG-104526 Change-Id: I590f59baf7137f78c4c294aa2bfbb040c80d4874 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix thread issue in TextEdit when font db updatesEskil Abrahamsen Blomfeldt2022-08-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | This amends 2fb43a35dfa08bb0746913e3363f1fcf21815e72, which introduced invalidation of text when the font database changes. The text invalidation is done from the render thread, which mostly works well because it is done during sync, so the main thread is locked. However, for TextEdit, the invalidation is more complex and would implicitly call documentChanged() which would then try to stop a timer. Since the timer has to be stopped from the owner thread, it would fail and throw a warning. So for TextEdit, we invoke the method on the main thread instead, which means it will use one extra update pass in order to properly invalidate its contents. Pick-to: 6.4 Fixes: QTBUG-105992 Change-Id: Idc020c682dcb2d1f3c66d043cf98fe9c6e4dc2a1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* TextArea: selectByMouse default=true, but not on touchscreensShawn Rutledge2022-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you drag a finger across a TextArea, it should not select text. - your finger probably covers several characters, so you can't see where you're selecting until afterwards - if the item is in a Flickable, flicking by touch should be prioritized - if flicking happens, the text cursor should not move; but to avoid losing too much functionality, we allow it to move on release, if the TextArea gets the release (i.e. if it still has the exclusive grab) - TextArea's pressed, pressAndHold and released signals continue to behave the same with touch as with mouse As with the TextEdit change in 90d3fac73a10b9363fd34e6757cc730d7a0c086c, we now distinguish mouse events that are synthesized from non-mouse devices and avoid mouse-like behaviors as described above, but there is no behavior change if the event comes from an actual mouse or touchpad. In QQuickPressHandler::mousePressEvent() we give the original event's device to the delayed press event, now that we check the device to distinguish "real" mouse events from those that are synthesized from touch. [ChangeLog][Controls][TextArea] The selectByMouse property is now enabled by default, but no longer enables selecting by dragging your finger across text on a touchscreen. Platforms that are optimized for touchscreens normally use special text-selection handles, which interact with Qt via QInputMethod. You can opt out of the behavior change by setting the environment variable QT_QUICK_CONTROLS_TEXT_SELECTION_BEHAVIOR=old. Pick-to: 6.4 Task-number: QTBUG-10684 Task-number: QTBUG-38934 Task-number: QTBUG-90494 Task-number: QTBUG-101205 Change-Id: Icbe81e547b1cf8d5e3cc3ed922f12c7b411ca658 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix bad rendering after text selectionShawn Rutledge2022-08-251-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 9db23e0e04906cf9ea33e23fa41f34955e5e6fe0 we added a new call to createTextNode(), but it turns out that it could be called again for the same block, a few lines below (in code that was originally added in dfdc4ce825e814b30449cfa1c85d3d2f47f8a845), if we have not reached the "last node that needed replacing or last block of the frame". This resulted in a memory leak: TransformNodes were created without parents, which b616028dae933e7ff6142d41bdafee8ad445a8ec tried to fix by calling addCurrentTextNodeToRoot(). That change made the code in "Update the position of the subsequent text blocks" re-add offsets that had already been added, which had the effect of moving down the blocks below the selected ones by the height of one line; but the new call to addCurrentTextNodeToRoot() was anyway just adding empty TransformNode instances to the scene graph. Afterwards we can see that any TransformNode that does not have a GeometryNode as a child is not actually rendering any text, it's just wasting memory. Having a debug operator for QQuickTextEditPrivate::Node, and using a QQuickTextEdit subclass in the autotest that checks the nodes corresponding to blocks rendered at the end of updatePaintNode(), makes this easier to see and verify. So now, if createTextNode() has already been called, we avoid calling it again a few lines below; but we keep the checks in place to make sure that every node which does not have a parent will get added to the scene graph (regardless of which line of code it was created on), so that there's no leak. It remains to be seen if this could be cleaned up further. Amends 9db23e0e04906cf9ea33e23fa41f34955e5e6fe0 and b616028dae933e7ff6142d41bdafee8ad445a8ec Pick-to: 6.3.2 6.3 6.4 Task-number: QTBUG-103819 Fixes: QTBUG-105208 Fixes: QTBUG-105555 Fixes: QTBUG-105728 Change-Id: I321980c705887bfdb37825f7e6ed8da3d200654e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* TextEdit: selectByMouse default=true, but not on touchscreensShawn Rutledge2022-07-231-10/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you drag a finger across a TextEdit, it should not select text. - your finger probably covers several characters, so you can't see where you're selecting until afterwards - if the item is in a Flickable, flicking by touch should be prioritized - if flicking happens, the text cursor should not move; but to avoid losing too much functionality, we allow it to move on release, if the TextEdit gets the release (i.e. if it still has the exclusive grab) So now we distinguish mouse events that are synthesized from non-mouse devices and avoid mouse-like behaviors as described above, but there is no behavior change if the event comes from an actual mouse or touchpad. Since most users want selecting text by mouse to "just work", and an actual mouse is precise enough to do so, and dragging a Flickable with the mouse is unintuitive (since most UIs don't allow it and most mice have wheels), selectByMouse now defaults to true, and has the stricter meaning that its name implies. To select text on a touchscreen, the end-user needs to rely on text-selection handles, which are provided on touch-centric mobile platforms, and could also be implemented from scratch if someone builds a custom text field using TextInput. In QQuickPressHandler::mousePressEvent() we give the original event's device to the delayed press event, now that we check the device to distinguish "real" mouse events from those that are synthesized from touch. [ChangeLog][QtQuick][TextEdit] The selectByMouse property is now enabled by default, but no longer enables selecting by dragging your finger across text on a touchscreen. Platforms that are optimized for touchscreens normally use special text-selection handles, which interact with Qt via QInputMethod. You can opt out of the behavior change by using an import version < 6.4. Pick-to: 6.4 Task-number: QTBUG-10684 Task-number: QTBUG-38934 Task-number: QTBUG-90494 Task-number: QTBUG-101205 Change-Id: Ia96f53cd7c6db5f995aab5505f61c13f9a4c4c0a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QQuickTextArea/Field: don't block hover eventsRichard Moe Gustavsen2022-07-191-0/+3
| | | | | | | | | | | | | | | | | | Controls shouldn't block hover from propagating by default. This was a regression in Qt 6.2 compared to Qt 5.15, and was fixed with 0c7b0a43064c8be452f4be74701f1dabce87f24c. But that patch didn't consider many of the items that overrode hover event handling from c++, like TextArea and TextField; they too need to ignore hover events, to not stop propagation - it's not enough to only do it in the base class. This patch fixes the regression that some controls and items were blocking propagation compared to Qt 5.15. Fixes: QTBUG-104537 Pick-to: 6.4 6.3 6.2 Change-Id: Ie047da6ac7d5be5ea6fd52d5a5446787df6d10f5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Deal with markdown fragments in TextEditShawn Rutledge2022-07-091-10/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | - as with rich text, append() and insert() assume that if the text is already markdown, the text to be inserted is too - as with rich text, text() and getFormattedText() return text with markdown formatting, whereas getText() and selectedText() convert it to plain text - Component.onCompleted markdown initialization is ok - pasting HTML from the clipboard preserves its formatting, and text() and getFormattedText() return text with markdown formatting - selectAll() and copy() make HTML available on the system clipboard We're beginning to use the goodies from qtbase 7c7606460403e6495b860134f28e8d4d45c6c810 [ChangeLog][QtQuick][TextEdit] TextEdit.insert(), append(), copy(), paste() etc. are now working with MarkdownText. Done-with: Ivan Solovev Pick-to: 6.4 Fixes: QTBUG-94462 Task-number: QTBUG-76105 Change-Id: I01049c769e0e9bfccaf96bf90cb2fcc066276e7c Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Don't trigger update when text edit is hiddenPaul Olav Tvete2022-06-181-7/+8
| | | | | | | | | | | | | At the same time clean up the logic around update/polish/ componentComplete. A polish() does trigger an update, so it should not happen before componentCompleted. Adding a polish call in componentCompleted makes sure we avoid the threading issues from QTBUG-38800 Fixes: QTBUG-99947 Pick-to: 6.4 Change-Id: I818168a90c1b05b7f77fa12de3dc5be3d89f133d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Do not leak in QQuickTextEdit::updatePaintNode()Andrei Golubev2022-06-171-0/+2
| | | | | | | | | | | Ensure all nodes created via d->createTextNode() within updatePaintNode have a parent. Some of the nodes missed parents due to overwrite of the local variable happening before addCurrentTextNodeToRoot() is called Task-number: QTBUG-103819 Pick-to: 6.3 6.4 Change-Id: I7261f6ad66c12e99601761073a2b0e931ff475ce Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix TextEdit/TextArea mouse cursor shape handling logicVladimir Belyavsky2022-06-161-14/+28
| | | | | | | | | | | | | | | | | | Previously IBeamCursor was wrongly shown in case when TextEdit was readonly and not selectable by mouse. Now ArrowCursor will be shown in such case. Additionally removed own mouse cursor shape handling logic in TextArea, so it will be unified now with derived logic from TextEdit. This is a change from 23f78b6b76fb9350a472485e34857e1a4842e5d3: we no longer attempt to restore a cursor that was set via setCursor(). [ChangeLog][QtQuick][TextEdit] TextEdit and TextArea now set their own mouse cursors more consistently, but without regard for any external call to setCursor(). Fixes: QTBUG-104089 Pick-to: 6.3 6.4 Change-Id: Iba4e0cb55d555b0f360d7856346ff9e8393b9e1e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Invalidate text when application fonts are added or removedEskil Abrahamsen Blomfeldt2022-04-081-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had multiple related issues due to application fonts being added or removed during the application lifetime. 1. If a text had font family "foo" set, and this font did not exist at the time, then loading "foo" at a later stage would not update the text to use the correct font, since the result of the previous request had been cached. 2. A variation of #1 was if the font "foo" was loaded by a FontLoader in the scene and referred to by name in the text component. In this case, there was a race condition, where the font lookup would sometimes yield different results on the main thread and on the render thread, and text would be garbled. 3. When a font was removed from the font database, then references to it would remain in the caches (glyph cache + font cache) in the render thread. With certain backends (DirectWrite, CoreText) this caused errors or even crashes, as the cached font engines would be referring to data that had been removed. The work-around for #1 and #2 was merely to avoid hardcoding names for fonts, but instead getting them from the FontLoader. This way, you can avoid requesting the font family before it is available (and thus avoid caching the wrong result). However, for #3 there is no known work-around. This patch fixes all three (together with a smaller patch for qtbase) by invalidating all text and related caches in Qt Quick when fonts are either added or removed from the font database. This does add some overhead if font loading happens during runtime, but the alternative is broken behavior and dangling pointers. This is done during the synchronization step. Before synchronization, the font cache is flushed and all text components are marked for update, so that fonts are re-requested against the new font database. After synchronization, we delete all distance field glyph caches which are not currently in use, to avoid having references to stale application font data in the list. [ChangeLog][Text] Fix multiple issues with usage of application fonts when they are added or removed during the lifetime of the application. Task-number: QTBUG-100697 Task-number: QDS-1142 Change-Id: Ib309e54e0ee97b6be6d2a7211964043fd51c9ec5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Improve cursorPosition description in TextInput and TextEdit docsJaishree Vyas2022-03-291-1/+9
| | | | | | | | | | Fixes: QTBUG-97169 Pick-to: 5.15 6.2 6.3 6.3.0 Change-Id: I060be767dd980c489d8e5426d67f2e8b6d21e96c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ivan Tkachenko <me@ratijas.tk> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* TextEdit: hide cursor outside viewport if ItemObservesViewportShawn Rutledge2022-01-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Given a TextEdit in a Flickable, when someone scrolls the text such that the text cursor is completely outside the viewport, we want the text cursor to be hidden. It is clipped if Flickable has clip: true, which is better for "pixel-perfect" clipping, but has a performance penalty. Anyway it still looked ridiculous in the case when clipping is not turned on, to have a stray text cursor appearing on top of some neighbor items, even though the text wasn't visible. To have awareness of the viewport (such as Flickable) within which it's shown, TextEdit has to opt-in with the ItemObservesViewport flag so that QQuickTextEditPrivate::transformChanged() will be called; the question is under what conditions. We already opt-in when the text is large; otherwise we don't really want to have updatePaintNode() called so often, unless other code opts in by setting that flag; because for short texts, the old way is more efficient (populate all the glyphs from the document into the scenegraph one time, and no need to update until editing happens). Task-number: QTBUG-83069 Pick-to: 6.3 Change-Id: Idd7cc9d2369d67b967eec50fe81964e6abe84e9c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* TextEdit: deal with scrolling backwards in rich textShawn Rutledge2022-01-061-3/+20
| | | | | | | | | | | | | | | | | | | | | | A bug was introduced in 9db23e0e04906cf9ea33e23fa41f34955e5e6fe0 : when scrolling backwards in some kinds of rich text, updatePaintNode() failed to re-populate the nodes that had been scrolled out above the viewport. That was because those nodes had been removed from textNodeMap, and then firstDirtyPos was set from the first node in textNodeMap. For some reason this didn't happen with the markdown document that I was testing (maybe because it had a table and an image near the beginning), but showed up when viewing an html document similar to the one we ship with the rich text example. So now we iterate backwards from textNodeMap.begin() when this happens, to find all nodes in the current frame that intersect the viewport as rendered. In the autotest we now use font.pixelSize in an attempt to make the rendered text ranges more consistent across platforms in CI; and we need to wait for the rendering to be redone after scrolling. Pick-to: 6.3 Change-Id: I70ef54c8d8facc439b9a6f8b5cb8e3a4a1c37e16 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* TextEdit large text: don't populate blocks outside the viewport into SGShawn Rutledge2021-12-031-12/+93
| | | | | | | | | | | | | | | | | | | | | | | When the text is larger than 10000 characters, we now avoid creating nodes for blocks that go outside the viewport. Each time the text moves relative to the viewport, we check whether the rectangular area that we know is "covered" with the text rendered so far is still enough to fill the viewport; if not, update the whole document: mark all existing SG nodes dirty, then delete and re-create them. [ChangeLog][QtQuick][Text] When given large text documents (QString::size() > 10000), Text and TextEdit now try to avoid populating scene graph nodes for ranges of text that fall outside the viewport, which could be a parent item having the ItemIsViewport flag set (such as a Flickable), or the window's content item. If the viewport is smaller than the window, you might see lines of text disappearing when they are scrolled out of the viewport; if that's undesired, either design your UI so that other items obscure the area beyond the viewport, or set the clip property to make clipping exact. Task-number: QTBUG-90734 Change-Id: I9c88885b1ad3c3f24df0f7f322ed82d76b8e07c9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* TextEdit: update all glyphnodes on QTD::contentsChanged() signalShawn Rutledge2021-05-071-0/+8
| | | | | | | | | | | | | When a syntax highlighter changes formatting, the actual text doesn't change, and QTextDocument emits contentsChanged() but not contentsChange(int, int, int). We need to regenerate QSG nodes. contentsChanged() is connected to QQuickTextControl::textChanged() and from there to QQuickTextEdit::q_textChanged(). Pick-to: 6.1 5.15 Fixes: QTBUG-74572 Change-Id: Ia62aa6d3adfc9a9d496ee8811db4c2d963dd0c54 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Android: Add possibility to copy text from read-only Qml TextEditPiotr Mikolajczyk2021-03-311-0/+3
| | | | | | | | | | | | In case of a read-only TextEdit it was imposibble to move text selection handles and copy the selected text from. You could see the handles but you couldn't move them, neither you could copy the text. Fixes: QTBUG-75556 Change-Id: I23e9a1948d01b5078046fe33559d13949bbde5d5 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-051-1/+1
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Change terminology to "look and feel"Jerome Pasion2020-10-291-2/+2
| | | | | | | | -should be "look and feel" Task-number: QTBUG-88010 Change-Id: I5eef099eec362144651dd95d74023a571c4ac08c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QQuickTextEdit: ensure we update after changing paddingRichard Moe Gustavsen2020-10-281-0/+4
| | | | | | | | | | | | | | As it stood we would never updated the paint node upon changes to padding. The result was that if you changed padding after start-up, you would not see any visual changes. This patch will ensure that we update the paint node when we change padding. Pick-to: 5.15 Change-Id: I2e9ed4406e8f01c26d1fa2ef09fe35a50f28411c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QQuickTextEdit: ensure we update document width when padding has changedRichard Moe Gustavsen2020-10-081-2/+3
| | | | | | | | | | | | | | | We use an if-test to check if the document width has changed before we set the new value. The problem is that the value we test against is different than the value we set. The result is that we can sometimes skip setting a new width on the document, even if padding has changed. This patch ensures that we use the same width for both testing and setting. Pick-to: 5.15 Change-Id: Ia8391999e8cc2b5be72fe525d396bf8c17ba0fa2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use OpenType font weightsJonas Karlsson2020-08-281-1/+1
| | | | | | Task-number: QTBUG-42248 Change-Id: Ib26d4945307b630b054e270b3213e1c9ad0d5357 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Do not resolve URLs when assigning them to a propertyUlf Hermann2020-06-221-1/+3
| | | | | | | | | | | | | | | We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-231-3/+2
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-6/+0
|\ | | | | | | Change-Id: I0d32fc5b99f8c9e4acb922fffe4dd5f3c5be553c
| * Remove hard-coded notes for 'Corresponding handler' for QML signalsTopi Reinio2020-03-101-6/+0
| | | | | | | | | | | | | | | | QDoc will generate these notes automatically. Task-number: QTBUG-37355 Change-Id: I8ed058ecbbcc630ad0351f6ce167c3fa61936f6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Make Font.weight an integer instead of enumerationEskil Abrahamsen Blomfeldt2020-01-211-4/+3
|/ | | | | | | | | | | | | | | | | | | The weight in QFont is an integer, allowing you to request a font of any weight given the predefined scale. In Qt Quick, however, you were limited to the predefined values. This is done in Qt 6 because it breaks conversions from string to weight, as the change in the autotest illustrates. [ChangeLog][Font] Made Font.weight an integer value rather than limit it to a predefined set of weights. As a side effect, conversion from strings to font weights are no longer supported. Fixes: QTBUG-80402 Change-Id: Ifbe9a0e608b63bfa93bb54999b0b3c1851ccfa88 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Text and TextEdit: document MarkdownText formatShawn Rutledge2020-01-171-28/+31
| | | | | | | Task-number: QTBUG-81306 Change-Id: I8ee50727f4e75eee8c0997f17193d8c99e855551 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-151-5/+4
|\ | | | | | | Change-Id: I7759f6b60f8fda6525b239c7ee2e034194d4ab85
| * Fix updating of text nodes in QQuickTextEditLars Knoll2019-10-141-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The update algorithm wasn't correctly removing all node that requires removing, as the startPosition is not always up to date when deleting lines of code. Instead, figure out the first Node after the changed region that is clean and keep that one as a reference. Amends 560a1991ac4524ff16352da23a2b54d717548f33. Fixes: QTBUG-74745 Change-Id: I4a2c5bd7a673af5cad1850e3a5b703f9554cd7e6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Igor Bugaev <freedbrt@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-121-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/quick/handlers/qquicktaphandler.cpp src/quick/items/qquicktableview.cpp Done-With: Richard Moe Gustavsen <richard.gustavsen@qt.io> Done-With: Ulf Hermann <ulf.hermann@qt.io> Done-With: Shawn Rutledge <shawn.rutledge@qt.io> Change-Id: If9558a33f01693ce96420c094e0b57dfff0626cd
| * Doc: Fix documentation warnings for qtdeclarativeTopi Reinio2019-08-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After recent changes to QDoc, it now correctly warns about missing documentation for QML method parameters - fix all of these and also do some minor language editing. Remove duplicated entries for - \qmlmodule Qt.labs.qmlmodels - \group qtjavascript as they were causing issues. Change-Id: I55cd670cc8a0cc6427cdb7945dbd7c28ea94f796 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add Markdown support to TextEditShawn Rutledge2019-05-291-2/+29
|/ | | | | | | | | | | | - textFormat can be set to MarkdownText, and markdown can be loaded into the text property - markdown text can be pulled out of the text property - if there are lists with checkboxes, you can click them to change the checkbox state Change-Id: I450115c732d737446ae71806e4abb18e8cc639f3 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-161-1/+18
|\ | | | | | | Change-Id: Ia93dc734ce25b3134b0f905f473a0c30777ceaf1
| * TextEdit: use I-beam cursor by default, pointing cursor for linksShawn Rutledge2019-05-151-1/+18
| | | | | | | | | | | | | | | | | | | | But do not interfere with any custom cursor that user code sets: remember and restore it when the mouse is no longer hovering a link. Task-number: QTBUG-14769 Fixes: QTBUG-50482 Change-Id: Ia4633c22d0ad42d07203d4dc3e330b90a5f94a7c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | TextEdit: Fix persistentSelection for readonly controlsNils Jeisecke2019-02-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TextEdit items with readOnly:true do not clear the selection on losing focus which is expected with persistentSelection:false. The reason is that a readonly TextEdit does never show a blinking cursor and thus the selection clearing within setCursorVisible never happens. This change adapts the implementation from TextInput. Fixes: QTBUG-50587 Change-Id: Ie66baaa0ccbc006359473862d8e9dbecd46a59f6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix Keys.onShortcutOverride for TextEditJan Arve Sæther2018-12-131-1/+2
|/ | | | | | | | | | | | | | It was not possible to override a shortcut with Keys.onShortcutOverride for TextEdit. This was because the ShortcutOverride event sent to the TextEdit was not passed on to the default event() implementation (of the base class) in the case that the QQuickTextEdit did not handle the ShortcutOverride event. Fixes: QTBUG-68711 Change-Id: I981738d8f92c77eadb8dd98b4245290d430525d3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix vertical alignment of images in a text documentLars Knoll2018-11-221-1/+1
| | | | | | | | | | | The vertical alignment was not calculated correctly in all cases, this should fix it by retrieving the height and baseline for the current text line and doing the calculation correctly in all cases. Change-Id: I5bb650ede46dc03d51bf0f64b77dc4ca77d30fd2 Fixes: QTBUG-59310 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Igor Bugaev <freedbrt@gmail.com>
* Fix updating of text nodes in QQuickTextEditLars Knoll2018-11-221-1/+12
| | | | | | | | | | | The update algorithm wasn't working correctly if there were two disconnected dirty regions in the textNodeMap. This could happend by e.g. programatically removing text at the beginning and appending at the end. Change-Id: I3de2c8efedb03c004c4c304d130360cbdb4485b7 Fixes: QTBUG-68863 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Add missing dots (qtdeclarative)Paul Wicking2018-06-191-1/+1
| | | | | | Task-number: QTBUG-68933 Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-7/+7
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix misleading doc for kerningRobert Loehning2018-02-081-3/+3
| | | | | | | | | | It currently sounds as if activating kerning would speed up drawing while the opposite is true. Change-Id: I7ba8caa82931617213c70570b6b81f82d5b61e52 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QQuickTextEdit: Simplify node handlingUlf Hermann2018-02-021-34/+40
| | | | | | | | | We don't need to manually manage pointers to nodes as QList can do that for us. Change-Id: I0185db2d5909178b3e36c8d1b7921bdbb1858ca6 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-09-201-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4regexpobject_p.h src/qml/types/qqmllistmodel.cpp src/quick/items/qquickanimatedimage_p.h src/quick/scenegraph/qsgrenderloop.cpp tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp Change-Id: If20ef62b2c98bdf656cb2f5d27b1897b754d3dc0
| * QQuickTextEdit: call implicitWidth() even if requireImplicitWidth is trueTim Jenssen2017-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before once requireImplicitWidth was set to true by requesting the implicit width, the implicit (and width) was never updated again, even if the text was updated/changed. Adding also a test Task-number: QTBUG-63153 Change-Id: Ie3bac4baeb14c2e69acc43d11a351ac91d5400da Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>