aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnodeengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rich text: Limit size of text objectEskil Abrahamsen Blomfeldt2025-10-311-6/+10
| | | | | | | | | | | | | | When we draw a text object, we need to store this in RAM since the QTextObjectInterface is QPainter-based. This could lead to over-allocation if the text object size was set to be very large. We use the existing image IO infrastructure for making sure allocations are within reasonable (and configurable) limits. Pick-to: 5.15 6.5 6.8 6.10 Task-number: QTBUG-141515 Change-Id: Ieae06a9e92a7bd078d22ab2314889201c2049122 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Set explicit default security level of all files with default securityJan Arve Sæther2025-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The files (folders) already processed are listed in each issue in epic QTBUG-134547 These files were processed half a year ago. In order to make it clear that all of these files are already processed, mark them with an explicit default security header. For the record, this was generated with this script: find -E . -regex ".*\.(cpp|h|hpp|mm|qml|js)$" | xargs python3 ~/bin/add-cra-header.py in the folders listed in each subtask of QTBUG-134547 (add-cra-header.py only exist at my desktop, but it simply adds the default security header if it doesn't already have any existing security header) QUIP: 23 Fixes: QTBUG-134547 Pick-to: 6.10 6.9 6.8 Change-Id: Ieb8c78ea6561fdbdd27c7b13185ece853eedf80f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Respect target DPR when drawing text objects in QQuickTextNodeEngineTor Arne Vestbø2025-04-241-2/+3
| | | | | | | | | | | | | | Instead of passing the DPR through as function arguments to each addFoo function we set the DPR on the QSGInternalTextNode and QQuickTextNodeEngine. We could have solved this by pulling the DPR from the QSGRootNode's renderer, but there might be more than one of them, and we're missing a setDevicePixelRatio in QSGAbstractRenderer (it's only exposed one level above, in QSGRenderer). Pick-to: 6.9 Fixes: QTBUG-127913 Change-Id: I48081d441259f0713cdc5f784eede6777b5fb601 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Port away from QPairZhao Yuhang2025-04-121-11/+11
| | | | | | | | QPair is just an alias of std::pair anyway. Task-number: QTBUG-115841 Change-Id: I26fc90adcc775aac9955ad57304af914dc4ed48f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickTextNodeEngine::addText(): don't crash if QTextLine is invalidShawn Rutledge2024-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | When a QTextBlock has been pulled out of a QTextDocument, lineNumberForTextPosition() returns -1, so lineForTextPosition() returns a default-constructed QTextLine whose `eng` pointer is null. QTextLine::textStart() needs to access `eng`, so we can't call it. The new autotest is similar to what a syntax highlighter does. However QTextLayout::setFormats() doesn't trigger QTextEdit::update() by itself. QTextCursor::endEditBlock() results in QTD::contentsChanged() being emitted, which is connected to QQuickTextEdit::q_textChanged(); so we test it both ways to ensure that it doesn't crash in either case, but one can see the text turn green only in the case that update() is called somehow. Done-with: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Fixes: QTBUG-126886 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I9c1093af7002432add3b4ab856a41ce2f9af4619 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* QtQuick: Straighten out some logging categoriesUlf Hermann2024-06-191-2/+1
| | | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I485bb7e4379e86f72619f848399ad58c76586851 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickTextNodeEnding: Fix borderCollapse in renderingCarl Schwan2024-04-301-5/+9
| | | | | | | | | | Handle the border collapse attribute from QTextTableFormat Task-number: QTBUG-120986 Fixes: QTBUG-124569 Pick-to: 6.7 Change-Id: I41a5231adf8878b798f527fbab35994063eac1f1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* richtext formatting of numbered and bullet lists (<ol> and <ul>)Sami Shalayel2024-04-151-0/+6
| | | | | | | | | | | | | | | | | | | Set the text color before drawing bullet points for numbered and bullet point list, instead of using the color of the previous block. It seems all other calls to addUnselectedGlyphs() are preceded by some code to set the current color, so do it also for the bullet points. Extend the manual test for syntaxhighlighter to add the reproducer. Fixes: QTBUG-111337 Fixes: QTBUG-123855 Fixes: QTBUG-63741 Task-number: QTBUG-57833 Task-number: QTBUG-26612 Task-number: QTBUG-73859 Change-Id: I51a75152416e07c7f84f99b49e2a4b6ca72e78e9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Avoid adding empty BinaryTreeNodes during text processingShawn Rutledge2023-12-121-0/+3
| | | | | | | | | | | A crash is possible in calculateBoudingRect() (called from QSGSoftwareGlyphNode::setGlyphs()) if QRawFont has a null font engine. This seems to coincide with empty glyph runs; and anyway it seems useless to keep nodes corresponding to empty glyph runs. Pick-to: 6.7 Change-Id: I1c68e472fe75ab9a8bd63c74cb51f81c642c4203 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Get rid of QQuickTextDocumentWithImageResourcesShawn Rutledge2023-12-041-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users want to be able to provide their own QTextDocument instances to TextEdit; but we had been creating a subclass called QQuickTextDocumentWithImageResources, which was an obstacle for that. QTextDocumentPrivate has two QMaps to hold resources, but QQuickTextDocumentWithImageResources existed for the purpose of caching remote resources, which only QQuickPixmap knows how to fetch. (This design was apparently invented as a workaround to the lack of virtual-filesystem functionality in Qt Core. If QtCore already knew how to fetch web resources from URLs in the background, QTextDocument could use it to do its own fetching of remote resources.) What we want instead of subclassing QTextDocument is to keep doing the fetching in Qt Quick (because there's no other choice for now), but get the images into the same QTextDocumentPrivate::cachedResources map where local-file resources are cached. As it turns out, since qtbase ac300a166f801a6f6c0b15278e6893720a5726f8 QTextDocument::loadResource() can use QMetaMethod::invoke() to call a method with the signature QVariant loadResource(int,QUrl) if such a method is found in QTD's parent object; so since QQuickTextEdit creates its own document by default, and is the document's parent, we can keep remote resource fetching functionality working by 1) providing the QQuickTextEdit::loadResource() method to be invoked, and 2) moving the document to the QML thread so that it can be invoked directly. (QMetaMethod::invoke() doesn't work across a queued connection, because we need to return a value: the QVariant.) QTD will already cache the images as soon as the call to loadResource() returns a valid QVariant. We ask for the QQuickPixmap not to be cached by passing an empty QQuickPixmap::Option enum to its ctor, which gets passed through to the load() function. When we consider fetching resources from a web server, it's unfortunate that the signature of QTextDocument::resource() sets the expectation that resources can be loaded immediately. But as long as QQuickTextEdit::loadResource() is waiting for fetching to be done, it keeps returning a default-constructed QVariant, which won't be cached; and it will be called again later, repeatedly, until it eventually succeeds. To ensure that it is called again when fetching is done, we call QTextDocument::resource() again, to provoke it to call our QQuickTextEdit::loadResource() one last time. If the returned image wasn't cached before, it will be after that. Then it's ok to delete the QQuickPixmap, and invalidate the TextEdit so that layout will be updated to include the image, now that we have it. But most of the time it's relatively boring: QTextDocument knows how to load local files on its own, and caches them. So we no longer need QQuickTextDocumentWithImageResources. But we still needed to replace QTextImageHandler with a custom implementation, as explained in bab2eaf3da299c471dd898c89cf356984b077412: we need QQuickPixmap for its QML-specific URL resolution relative to the Text item's context. And it turns out that in case the document contains only a missing image, the minimum size is 16x16 pixels, to reserve space to display a "broken image" icon as browsers sometimes do... we have never actually done that in Qt Quick AFAICT, but autotests have been enforcing the 16x16 minimum size all along. This is done in QQuickTextImageHandler::intrinsicSize() now. The same approach is taken with Text (when textFormat is RichText or MarkdownText. In case of StyledText, there is no QTextDocument instance, and resource loading is taken care of entirely within QQuickText.) For the autotests, friendly use of QQuickPixmapCache::m_cache requires QT_BEGIN_NAMESPACE. Task-number: QTBUG-35688 Change-Id: I8ad8142b3b3790254dd56d6cfe5209d641465f08 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix thin text decoration with fractional scalingEskil Abrahamsen Blomfeldt2023-11-151-1/+1
| | | | | | | | | | | | | | | | | | | With fractional scales, 1 pixel thin underlines and other text decoration get a lot of aliasing effects. Sometimes it will disappear completely and other times it will fill two pixels. The rendering depends on the fractional position of the line, so any change that moves the text may cause the line to render at a different width, causing instability when resizing layouts for instance. We were using rectangle nodes for this for convenience, but even with antialiasing enabled, that does not look correct for single-pixel lines. Instead, we use the new curve renderer which can also draw nice antialiased straight lines. Fixes: QTBUG-86977 Change-Id: I1367b1e2d25d167fac7d6284cb40a652ef4c3e9a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix missing paragraph containing object replacement charEskil Abrahamsen Blomfeldt2023-11-071-1/+1
| | | | | | | | | | | | | | If a user manually adds an object replacement char, it will not have a corresponding object, but we would still skip the paragraph in this case, causing the text to disappear. [ChangeLog][Text] Fixed an issue where a paragraph containing the Object Replacement Character (U+FFFC) would be invisible. Pick-to: 6.5 6.6 Fixes: QTBUG-78441 Change-Id: I04a20b8287895bbed5d1f22f1a449d6dbd9d448b Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Make text node scenegraph API publicEskil Abrahamsen Blomfeldt2023-09-011-1/+1
| | | | | | | | | | | | | | A lot of functionality is hidden underneath this, so exposing this API will make it possible to build custom text-based components for Qt Quick. [ChangeLog][Text] Added QSGTextNode and QQuickWindow::createTextNode() for creating scene graph nodes containing text. This can be useful when building custom Qt Quick items with text. Fixes: QTBUG-72773 Change-Id: I4810589cc28eb1cdfe91c9d8b66f4c6fe52a0c6a Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix positioning of text decoration with some fontsVladimir Belyavsky2023-01-111-4/+1
| | | | | | | | | | | | | | | Actually it just reverts 4db31cbd4e29cf5387f4332537f8ea9e0e9f62ae. When calculating a position for a decoration, we should just apply the decoration's offset to the line's baseline (line.y + line.ascent). The regression was introduced by 54b5287adf4f5b004fcf47840c7f2e1e561a90c1 in Qt 5.6, when we switched from prepending leading to the baseline of text and started appending it instead. Pick-to: 5.15 6.2 6.4 6.5 Fixes: QTBUG-96700 Fixes: QTBUG-97594 Change-Id: I7f816b71859ffcb6b1c641f0c8b8e1d810bfc525 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | | | | | | | 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>
* 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>
* Large Rich Text: don't populate blocks outside the viewport into SGShawn Rutledge2021-11-301-1/+18
| | | | | | | | | | | | | | If some parent item (such as Flickable, or QQuickRootItem) is acting as a viewport, QQuickTextNodeEngine::addTextBlock() will skip any block that is completely outside the viewport. The result is that Flickable { Text { } } works OK for a viewer of large rich text documents (such as HTML or Markdown). Task-number: QTBUG-60491 Task-number: QTBUG-90734 Change-Id: I6a7f20d2ac0e8d0f4da1a2ebf43cbbeb1e05cea0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Tables in RichText: make outer frame symmetricShawn Rutledge2021-10-201-1/+2
| | | | | | | | The right and bottom edges were off by the border width. Fixes: QTBUG-74335 Change-Id: I9d28c26f7c523031cfaee929c7d541978fa106a2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Implement horizontal rule rendering in textShawn Rutledge2021-10-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The rule is just a line drawn with the same thickness as an underline: it gets thicker as DPR increases. A horizontal rule can be created via <hr/> in RichText. In markdown it's called a "thematic break," and a line with - - - is one way to create it: https://spec.commonmark.org/0.30/#thematic-breaks <hr width=70/> or <hr width=70%> set the width in pixels, and percent of the text width, respectively; the rule will be centered within the line's bounding box in that case, as in QTextEdit etc. The color can come from QTextFormat::BackgroundBrush if it's set on the QTextBlockFormat, but otherwise falls back to the text color. This can be done with CSS styling: <hr style="background-color:green;"/> [ChangeLog][QtQuick][Text] Horizontal rules (thematic breaks in markdown) are now rendered as simple horizontal lines, either in the same color as the text, or as specified via CSS background-color. Fixes: QTBUG-74342 Task-number: QTBUG-81306 Change-Id: I64f9daf28994225d1a8383d8e2e01e611a0a0237 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Don't dereference node unless it is actually assignedVolker Hilsheimer2021-05-201-3/+2
| | | | | | | | | | | While the static analyzer doesn't see in 727c503c234d162fb8d62b1aadf328de that node must never be nullptr when i == 0, the statement doesn't have to be executed at all if the previous block wasn't run as well to assign node. Pick-to: 6.1 Change-Id: I2edd901674e7603a317ebdf98dd4800b768a0a5b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add support for QTextCharFormat::underlineColor in highlighers and CSSShawn Rutledge2021-05-071-7/+32
| | | | | | | | | | | | | | | | | | | | | When a QSyntaxHighlighter calls setUnderlineColor(), TextEdit will use that color for underline, overline and strikeout rendering. Likewise when Text has textFormat: Text.RichText and the HTML contains CSS styling specifying text-decoration-color, it will be applied (depending on the css support in QTextHtmlParser to call setUnderlineColor()). Added a manual test. [ChangeLog][QtQuick][TextEdit] When a QSyntaxHighlighter calls QTextFormat::setUnderlineColor(), or CSS style contains text-decoration-color, Text and TextEdit will now use that color for underline, overline and strikeout rendering. Task-number: QTBUG-87260 Task-number: QTBUG-74572 Task-number: QTBUG-39617 Change-Id: Ia2b564d5366ff67bb5df4f6c9e68ff5773ca5d6a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Use unique_ptr to clarify ownership of QQuickDefaultClipNode objects"Volker Hilsheimer2021-03-221-5/+5
| | | | | | | | | | This reverts commit 02c6e7bc3aca42a188b772aa9794b919e60017e7. It broke text selection, the currentClipNode pointer must not be reset to nullptr even if ownership is transferred to a node. Pick-to: 6.1 6.0 5.15 Change-Id: Ia66f7ed4be17916f3725bd3cb2cbd0e7c9d6327a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use unique_ptr to clarify ownership of QQuickDefaultClipNode objectsVolker Hilsheimer2021-03-191-5/+5
| | | | | | | | | | | | | | | The clang static analyzer warns in 3df1fff15a10a64372ed4f92ba05271f about a potential memory leak. While that particular claim is a false positive (the loop is always entered if sortedIndex is not empty), the re-use of the currentClipNode variable makes it hard to follow the object ownership, and there might still be a potential memory leak. Use std::unique_ptr to force explicit transfer of ownership, and get implicit destruction of objects not owned at the end of the scope. Pick-to: 6.1 6.0 5.15 Change-Id: If826e1d81b92f1da60aae2262b628dcaaa2e592a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Improve a qHash implementationGiuseppe D'Angelo2020-06-181-2/+2
| | | | | | | Fixup the signature and improve qHashMulti. Change-Id: I701a0f43ff0533269964334767dc220b8fd48188 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix the vertical alignment of images in a text documentDominik Holland2020-06-171-4/+6
| | | | | | | | | | Try to align with the HTML standard as much as possible. AlignMiddle is between AlignTop and AlignBottom. Fixes: QTBUG-84981 Pick-to: 5.15 Change-Id: Ie99aef0d09a6ece751883492748630526c4a1195 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Update dependencies on 'dev' in qt/qtdeclarativeQt Submodule Update Bot2020-06-111-3/+1
| | | | | | | | And workaround hash issue for now by using qHashMulti Also, fix test build failure Change-Id: Ia6b696b2531149206c73e7a5a958d7fba74a0f19 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickTextNodeEngine: prevent renderring transparent selection colorWang Chuan2020-06-051-2/+2
| | | | | | | | | | It is not necessary to render selection color which is transparent. Pick-to: 5.15 Fixes: QTBUG-83819 Change-Id: I45c086652e194192619aad025121e6064ab37a58 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Change qHash return value to size_tFabian Kosmale2020-04-161-1/+1
| | | | | | | | Else on Windows there's a warning: conversion from 'size_t' to 'uint', possible loss of data Change-Id: Ifed4899409a13fed31c206ae1e0f195280ee2925 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Introduce new mechanism to manage palette functionality in QMLVitaly Fanaskov2020-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main goals of these changes: 1) Add an ability to work with disabled and inactive palettes from QML 2) Eliminate massive code duplication in qtquickcontrols2 module 3) Provide easily extensible architecture for this piece of functionality Architectural part. Palette It was decided to not change existing QPalette, but add thin wrappers around it to provide all required functionality. These wrappers are highly coupled with QPalette class because of using some enum values from it. There are two new classes QQuickPalette and QQuickColorGroup. QQuickPalette class inherits QQuickColorGroup class and represents Active/All color group. QQuickPalette also provides an access to three color groups: Active, Inactive, and Disabled. In order to access colors the special class QQuickPaletteColorProvider is used. This is a wrapper around QPalette that provides some convenience functions. Interface The private property "palette" should be exposed. Implementation All private parts of classes that implement QQuickAbstractPaletteProvider have to inherit QQuickPaletteProviderPrivateBase class. This template class implement all functionality: create palette, resolve dependencies, connect objects etc. This is important to mention that related data is lazily allocatable on demand only. Hence, there is no memory overhead for regular items. Change-Id: I911424b730451b1ad47f68fd8007953b66eddb28 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QQuickTextNodeEngine: reduce redundant rendering of glyphsWang Chuan2020-01-161-1/+1
| | | | | | | | | | | | | | The glyphs between two text blocks that have different text format will be rendered twice, and in this case the rich text will be display incorrectly.(e.g., the first text block is a superscript and the second is a normal text) Fixes this by reduce the redundant rendering of glyphs between two differently formatted text blocks Fixes: QTBUG-80759 Change-Id: I51ca3f7df1ad368d28df9beb6124a87bf50f0e01 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Prepare for QTextBlockFormat::MarkerType to be an enum classShawn Rutledge2019-10-091-3/+3
| | | | | | | | | Use it in fully scoped form, and treat it as int in qDebug. Unfortunately since QTextBlockFormat is not a QObject, we can't easily use Q_ENUM to have moc translate the enum values to strings. Change-Id: I2eb605e8f2756ce62dcbaffa6bfed237ada4021d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-171-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4baselinejit.cpp src/qml/jsruntime/qv4vme_moth.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: Iec7cd27ddad0281bd3b7833fb6b252f66a6ae5d6
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-09-121-2/+2
| |\ | | | | | | | | | Change-Id: I6472cd72b27c69257efe54376e428274ebf68050
| | * QQuickTextNodeEngine: don't create background when its alpha is 0Wang Chuan2019-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the alpha value for the background color of a text element is 0, we don't need to create a rectangle node to represent it, as the rectangle will be invisible anyway. [ChangeLog][QtQuick][QQuickTextNodeEngine] don't create a new rectangle node as the background of text, when the alpha of it is 0 Fixes: QTBUG-76137 Change-Id: I40c624ee8f61740fd07e7d3751a78b6224882913 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-08-201-1/+1
|\| | | | | | | | | | | Change-Id: I9ce3eee3d6f88783b9e20110a2814bee805291a4
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-08-051-1/+1
| |\| | | | | | | | | | Change-Id: I042df89ddd381c7fbb944b7ff49d5b45b764fd47
| | * Fix possible crash with top/bottom aligned imagesEskil Abrahamsen Blomfeldt2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An image inside at the end of a text block which did not start at text position 0 would resolve to an invalid QTextLine, since we passed the document position to lineForTextPosition(), which expects the relative block position. If the image was aligned to top or bottom, so that the extracted QTextLine was actually accessed, this would cause a crash. [ChangeLog][QtQuick][Text] Fixed a bug where aligning an image to "top" or "bottom" could cause a crash under certain circumstances. Task-number: QTBUG-77217 Change-Id: Iaa239ba482f2a765703656e4116cbebb8435a66e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add Markdown support to TextShawn Rutledge2019-05-091-0/+11
|/ / | | | | | | | | | | | | "Markers" (only checkboxes so far) are a new feature too. Change-Id: I5a0ea337ec6cf8bdadf3b4729caaa579e8b625b5 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-131-7/+11
|\| | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/animations/qsequentialanimationgroupjob.cpp Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
| * Text: render table cell backgrounds properlyShawn Rutledge2019-02-281-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickTextNodeEngine::addTextBlock() was noticing the background color of text fragments, including those within table cells (and adding to the colorChanges vector for rendering), but not rendering a rectangle for the background of the entire table cell. So while the color was correct, it only took up as much space as the text itself. Also, QTextDocumentLayout needs to be told how much width is available so that QTextDocumentLayoutPrivate::layoutTable() will allocate cell width appropriately in case width is given as a percentage, e.g. <td width="20%">. This is done by calling QTextDocument::setPageSize() with correct width in pixels rather than zero. Fixes: QTBUG-72457 Change-Id: I5c8f861829f76d1cf4044fccd1142c3817bb33bc Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QtDeclarative: replace deprecated functionsChristian Ehrlicher2019-02-131-2/+2
| | | | | | | | | | | | | | | | | | | | Replace the deprecated functions with it successors: - QFontMetrics::width() -> horizontalAdvance() - QLayout::setMargin() -> setContentsMargins() Change-Id: I2a2557cdb2eaec40e2c9955a0082372c582ec6b8 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-241-10/+17
|\| | | | | | | Change-Id: I57e4b762dcccf2f7f6e4b659f6fc8c40465d3322
| * Fix vertical alignment of images in a text documentLars Knoll2018-11-221-10/+17
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Render inline custom text objectsAllan Sandfeld Jensen2018-11-191-1/+1
|/ | | | | | | | | | | | In QTextDocumentLayout inline objects are skipped if they have a frame and the frame-style isn't inflow. That inverted should be to only render it if it doesn't have a frame or is the frame-style is inflow. Fixes: QTBUG-32525 Fixes: QTBUG-70748 Change-Id: I259281ea45c9ba7295c6b3e116a941314ada22e5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-24/+24
| | | | | | | | | | | | | 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>
* 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>
* Fix flow text objects in beginning of RTL blockEskil Abrahamsen Blomfeldt2016-11-141-1/+6
| | | | | | | | | | | | | If the block is right-to-left and starts with a text object, it should be aligned to the right edge of the QTextLine instead of the left one. [ChangeLog][QtQuick][Text] Fixed placement of flowing text objects in the start of a right-to-left block. Task-number: QTBUG-43133 Change-Id: Id790e88f3464280f124c38b4260386b84cac8826 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickTextNode: Minor cleanupRobin Burchell2016-07-111-18/+18
| | | | | | | Move decorations to QQuickTextNodeEngine, as the only place that uses them. Change-Id: I7d0b2bf8979bf5d7e447beac02c3419da4edb759 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-1/+4
|\ | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp Change-Id: I26d6435a29cac3840bb567ade5149c2562a94bf9