summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Support foreground gradient in CSS parser and HTML generatorEskil Abrahamsen Blomfeldt2024-03-181-0/+47
| | | | | | | | | | | | | | | Qt supports some complex foreground brushes which we cannot express using normal CSS, so we introduce a Qt-specific property for this. We already had some support for background gradients in widget style sheets, but this expands support to foreground brushes of text when converting a QTextDocument from and to HTML. It also adds an optional "coordinatemode" attribute to the gradient functions so that this can be faithfully restored from HTML. Task-number: QTBUG-123357 Change-Id: I3d6dd828f68272995c8525bec5a7b421fdbed670 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Implement support for stroke color and width in CSS parserEskil Abrahamsen Blomfeldt2024-03-181-0/+12
| | | | | | | | | | | | | | | CSS does not have text outline properties, instead different browsers have custom properties for this. That currently means that you can have a QTextDocument where you applied a stroke to text and textEdit.setHtml(textEdit.toHtml()) will remove it. Since a primary goal of the HTML support in QTextDocument is that it can be used to save and faithfully restore its contents, we implement qt specific properties for stroke. Task-number: QTBUG-123357 Change-Id: Id9cf63abfabe2109ffb6fd74f9cb013304763ccb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QTextHtmlImporter: don't forget to appendBlock after block tag closedShawn Rutledge2024-03-011-0/+2
| | | | | | | | | | | | | | | If we see a closing tag that really demands a new block after it, like </ul>, that needs to be done even if some ignorable whitespace and "inline" tags come after it. Don't get distracted by those. Also add a comment in QTextDocument::setHtml() to remind the reader that HTML parsing is a two-pass algorithm. Pick-to: 6.6 6.7 Fixes: QTBUG-81662 Change-Id: If723c9d3c211a684725055a06bcf87be4e38923a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Text widgets: document find() behavior with QRegularExpressionGiuseppe D'Angelo2024-02-261-0/+4
| | | | | | | | | | | | | | The various find() overloads that take a QRE *ignore* the case sensitivity option set on the QRE object itself. They instead apply the case sensitivity passed in the flags (see QTextDocument::find). I think it was an historic mishap, but it's too late to change now. Amend the documentation. Change-Id: I526650d89a98777c7bb839b27d2f2e536a43ca4f Pick-to: 6.7 6.6 6.5 6.2 5.15 Fixes: QTBUG-88721 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Extract and re-write "front matter" in markdown documentsShawn Rutledge2024-02-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's increasingly common for YAML to be used as metadata in front of markdown documents. md4c does not handle this, so we need to remove it ahead of time, lest md4c misinterpret it as heading text or so. The --- fences are expected to be consistent regardless of the format of what's between them, and the yaml (or whatever) parser does not need to see them. So we remove them while reading, and QTextMarkdownWriter writes them around the front matter if there is any. If your application needs to parse this "front matter", just call qtd->metaInformation(QTextDocument::FrontMatter).toUtf8() and feed that to some parser that you've linked in, such as yaml-cpp. Since YAML is used with GitHub Docs, we consider this feature to be part of the GitHub dialect: https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter [ChangeLog][QtGui][Text] Markdown "front matter" (usually YAML) is now extracted during parsing (GitHub dialect) and can be retrieved from QTextDocument::metaInformation(FrontMatter). QTextMarkdownWriter also writes front matter (if any) to the output. Fixes: QTBUG-120722 Change-Id: I220ddcd2b94c99453853643516ca7a36bb2bcd6f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QTextDocument: Add missing default pixel font size check for html exportViktor Arvidsson2024-01-181-1/+3
| | | | | | | | If the size of the documents default font is specified in pixels all text ranges would get wrapped in a span specifying the font size again. Change-Id: Iae2ea34d79bb6253badd8a0575489d3fb6409eba Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Modify the MDI manual test to allow multiple views of same documentShawn Rutledge2023-11-021-0/+5
| | | | | | | | | | | | | | - editing same document in different views is possible? yes - resizing one QTextEdit calls QTextDocument::setTextWidth(), which affects the width in the other view too. You can resize either one, but you can't have two views with different layouts, of course. Added a categorized log message in QTextDocument::setTextWidth() for a sanity check. Task-nunber: QTBUG-35688 Change-Id: I59c4d10143fda3a66b946237832274d67f9d9d45 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Qt::mightBeRichText: port to QAnyStringViewAnton Kudryavtsev2023-10-091-12/+28
| | | | | | | | [ChangeLog][QtGui] Ported Qt::mightBeRichText() to QAnyStringView (was: QString). Change-Id: Ib5633ed45cba5f4f1211438397624574f7431908 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* qtextdocument: replace fromLatin1 with L1 literalAnton Kudryavtsev2023-10-051-4/+8
| | | | | | | to reduce allocations Change-Id: Ie6f734269c9e880ff208629a625c88f4841e9533 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qtextdocument: use qsizetype moreAnton Kudryavtsev2023-10-051-7/+7
| | | | | | | | | in Qt::mightBeRichText, Qt::convertFromPlainText and emitFrameStyle to support large strings Pick-to: 6.6 6.5 6.2 Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTextDocument::toPlainText: avoid unconditional detachAnton Kudryavtsev2023-09-121-2/+10
| | | | | | | Let's find replaceable chars and then do detach Change-Id: I4a4360d73a97af2388f4f2f284949ffcfbc48836 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Qt::mightBeRichText: use QVLA moreAnton Kudryavtsev2023-09-121-4/+4
| | | | | | | to reduce allocations Change-Id: I59e131bcdd626f740a73e621b926f4c7dad4738a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add QTextDocument* constructor argument to QTextMarkdownImporterShawn Rutledge2023-09-011-1/+1
| | | | | | | | | | | | | | | | | QTextMarkdownImporter::import() took a QTD* as if it would be ok to reuse one instance of QTextMarkdownImporter for repeated importing into different documents; but in practice, we never do that: in fact it's usually a short-lived, stack-allocated object, as in QTextMarkdownImporter(&doc, QTMI::DialectGitHub).import(input); So it's less clumsy internally to require the document be provided to the constructor: that way a QTextCursor can be constructed immediately too, as part of the importer object rather than separately on the heap. This is private API, unused outside qtbase. Change-Id: I8041ceb33cb7e7608df55dc5a963292c585afb90 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Remove links from the Text Object exampleVolker Hilsheimer2023-06-091-1/+1
| | | | | | | | It's an example in Qt SVG that is to be removed. Pick-to: 6.5 6.6 Change-Id: I6e8cf38885649ca10f70a70b8400873c97bf1698 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add QTextListFormat::start: html and markdown ordered list index offsetNicolas Werner2023-03-221-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | This is useful for a lot of applications that render text coming from sources which already support arbitrarily numbered lists (like chat applications for example). Application-side workarounds usually have significant overhead; and this feature has been requested multiple times. It should be possible to both read and write HTML with the <ol start="x"> attribute, and read and write Markdown with arbitrary numbers for the first item in a list. [ChangeLog][QtGui] QTextList now supports specifying a start index using the new QTextList::{setStart, start} functions. The HTML start attribute on ordered lists in rich text documents is now parsed and used when rendering a text list. Non-negative indices in markdown lists are now also parsed and written properly. This allows starting a list with a different number than 1. Fixes: QTBUG-30407 Fixes: QTBUG-65384 Task-number: QTBUG-107562 Change-Id: Ib35b9378d9134ffedaa2d92f728b0984793aa7c1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-2/+3
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QTextDocument::loadResource(): invoke parent via direct connectionShawn Rutledge2022-11-091-1/+2
| | | | | | | | | | | | | | | | If QTextDocument::loadResource() gets called from a different thread than the thread that the QTD object (and *necessarily* its parent, if it has one) live in, we would get the warning "Unable to invoke methods with return values in queued connections". Rather, ensure that it's invoked only via a direct connection. Amends ac300a166f801a6f6c0b15278e6893720a5726f8 Pick-to: 6.4 Task-number: QTBUG-35688 Change-Id: I35644f7cd54b1f40362d3d45c2a120883f7a2e61 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = 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'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use CSS classes on html list items for checkbox supportShawn Rutledge2022-06-111-1/+15
| | | | | | | | | | | | | | If we replace the bullet character with a UC checkbox character, it looks ok in a browser, and the HTML parser can recover the BlockMarker attribute from the css class. [ChangeLog][QtGui][Text] Checkbox list items can now be read and written in both HTML and Markdown, including conversions. Task-number: QTBUG-103714 Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QTextDocument: add setLayoutEnabled()David Faure2022-05-261-0/+34
| | | | | | | | | | | | This allows to set up everything first - without paying for the layout calculation at every step - and only then trigger the layout once. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width Change-Id: I138bd1d58941d029bc0a36d2730216778f1fbd97 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix crash in tst_qquicktext::implicitSizeEskil Abrahamsen Blomfeldt2022-05-201-35/+0
| | | | | | | | | | | | | This reverts commit 1e938c348b936328fafbcaae4c0c7d91003143e5 and bb2f4d08d9d138e4f70d6d6db46e24e34500becc. bb2f4d08d9d causes the crash, but 1e938c348b93 amends it, so this reverts both. When the cause of the crash has been determined and mitigated, the patches can be recreated. Fixes: QTBUG-103719 Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006 Reviewed-by: David Faure <david.faure@kdab.com>
* QTextDocument: add setLayoutEnabled()David Faure2022-05-191-0/+35
| | | | | | | | | | | This allows to set up everything first - without paying for layouting at every step - and only then trigger layouting. Same performance behavior as setTextWidth(0), but this is a more explicit/readable API. Change-Id: I044dbd8b1301b1c97a92f9a29ccde2baf27a7665 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-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. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtGui: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1945741794c25679a9d94c0d68c8642e2c823502 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtGui: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-281-4/+4
| | | | | | Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-281-209/+211
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-131-85/+85
| | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add css media rule support for QTextDocument::setHtml()Ralf Habacker2021-12-151-2/+14
| | | | | | | | | | | | | | | | | CSS styles can contain '@media <rule> {...}' blocks, which were previously ignored for all values except "screen". To use a media rule other than the default "screen" rule, specify it before calling setHtml() with setMetaInformation() and the new info value 'CssMedia'. [ChangeLog][Gui][QTextDocument] Add css media rule support for QTextDocument::setHtml() Pick-to: 6.3 Fixes: QTBUG-98408 Change-Id: Ie05f815a6dedbd970210f467e26b116f6ee3b9ca Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Support background-color CSS styling on <hr/>Shawn Rutledge2021-10-141-2/+10
| | | | | | | | | [ChangeLog][QtGui][CSS] The background-color style can now be applied to <hr/> to set the rule color. Task-number: QTBUG-74342 Change-Id: Ib960ce4d38caa225f258b6d228fb794cef43e1b7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Support CSS text-decoration-color in underlines, overlines, strikethroughShawn Rutledge2021-05-071-0/+5
| | | | | | | | | | | | Also add a feature to the textedit example to set this value. [ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines and strikethrough. Fixes: QTBUG-82114 Task-number: QTBUG-39617 Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Write out the HTML correctly for nested listsAndy Shaw2021-05-051-3/+26
| | | | | | | | | | | | | | When we are having nested lists then we need to ensure that the HTML is outputted correctly so that the closing list and item tags are placed in the right order. [ChangeLog][QtGui][QTextDocument] The output of toHtml() now handles nested lists correctly. Fixes: QTBUG-88374 Pick-to: 6.1 5.15 Change-Id: I88afba0f897aeef78d4835a3124097fe6fd4d55e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Export text-decorationAllan Sandfeld Jensen2021-05-051-7/+22
| | | | | | | | | It used to be ignored because we couldn't disable it, but that works fine now. So re-enable it. Fixes: QTBUG-91171 Change-Id: I4cf966211bb200b73326e90fc7e4c4d3d4090511 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Replace QTextDocumentResourceProvider with a std::functionVolker Hilsheimer2021-03-301-10/+52
| | | | | | | | | | | | | | | | | | | | | | 376e3bd8ecf40881685714f6f19e12d68e92127e added the new class for Qt 6.1, but during header review we concluded that using a class introduces complexity wrt instance ownership and API design that can be avoided by using a std::function instead. The functionality is tied to QTextDocument, so the type definition and the default provider API is added there. Since std::function is not trivially copyable, the atomicity of the previous implementation is not maintained, and concurrent modifications of and access to the global default provider from multiple threads is not allowed. The relevant use case can be supported by implementing a resource provider that is thread safe. Task-number: QTBUG-90211 Fixes: QTBUG-92208 Pick-to: 6.1 Change-Id: I39215c5e51c7bd27f1dd29e1d9d908aecf754fb7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Rename QUrlResourceProvider to QTextDocumentResourceProviderVolker Hilsheimer2021-03-291-4/+6
| | | | | | | | | | | | | | | | | While the class name is now a bit more than a mouthful, it's purpose is very narrowly tied to QTextDocument, so don't use a very generic name for it. That resources are provided based on a URL is to some degree an implementation detail, and URLs are resource locators so we don't need that in the class name. Address code review comment for 6.1. Add documentation and links to existing APIs with a similar purpose. Task-number: QTBUG-90211 Task-number: QTBUG-92208 Pick-to: 6.1 Change-Id: I4f09057cc2f53a5595513c1c9422e6ccaad6ca13 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Introduce QUrlResourceProvider to load resources for HTMLAlexander Volkov2021-01-121-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | QTextDocument and the text editor classes suggest to override their loadResource() methods to provide data associated with a text document. This approach has the following drawbacks: - it requires subclassing - there is no way to set a global resource provider - QLabel is missing virtual loadResource() method and it can't be added without breaking ABI QUrlResourceProvider is designed to solve these issues. One should create a derived class that implements QUrlResourceProvider::resource(). The objects of the derived class then can be set for any text document. The default resource provider can be set with QUrlResourceProvider::setDefaultProvider(). This change also adds QLabel::setResourceProvider(), which doesn't break ABI. [ChangeLog][QtGui][Text] Introduced QUrlResourceProvider that allows to load resources for HTML. It is intended to replace the use of QTextDocument::loadResource(). Change-Id: Iaf19b229f522a73508f20715257450fe58f68daf Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-5/+1
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Add missing brief statements for \property documentationTopi Reinio2020-11-121-2/+2
| | | | | | | | ... where applicable. Fixes: QTBUG-88232 Change-Id: I835df434765caededd35d5114965b4a1663e7942 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Rename QRangeCollection to QPageRanges, make it a proper value typeVolker Hilsheimer2020-11-081-6/+4
| | | | | | | | | | | | | | | | | | | | | | | The type is specific about printing, so give it a name in line with QPageLayout and QPageSize. As per API review comment, it's not clear why this type should not be a regular, copyable and movable value type. It stores a list of intervals. Give it value-type semantics, as an implicitly shared class. Convert the parse method into a static factory function. Add a Range type and use it instead of the semantic-free QPair. Move QPrinter getter into QPagedPainteDevice, make it return a copy rather than a pointer, and add a setter. Extend test case to cover all members and more merge cases. Fix bugs found that way. Fixes: QTBUG-88113 Change-Id: If17ea4d410d49f16b097e88b7979db5d72add820 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-4/+4
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix some qdoc warnings: function parameter namesVolker Hilsheimer2020-09-221-5/+6
| | | | | | | In QTextDocument and QTextFormat, standardize language a bit. Change-Id: I7c81ecc7a32e36ec32214e6b5386a2827cfcbc3f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Mark obsolete QPrinter functions as deprecated from 5.15 onVolker Hilsheimer2020-09-031-2/+2
| | | | | | | | | | | Some of the methods are overrides of virtuals in QPagedPaintDevice, so document and mark those as obsolete as well. Adjust code that calls those APIs to use the recommended replacement. Change-Id: I3cd1980609ea20808d17379a5f97ca595e869875 Pick-to: 5.15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Qpagedpaintdevice: Use marginsF instead of internal struct marginsPeng Wenhao2020-09-011-3/+6
| | | | | | | resolve remaining Qt6 TODOs Change-Id: Iad659a09ddfe136bdc545bc0635b4c695540c58b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Compile textdocument-end snippetsPaul Wicking2020-08-281-1/+1
| | | | | | | | | | | | * Extend GUI snippet compilation with textdocument-end snippet. * Rename the snippet file and replace main() with wrapper(). * Dedent the snippet itself. * Update documentation that includes the snippet. Done-with: Nico Vertriest <nico.vertriest@qt.io> Task-number: QTBUG-81486 Change-Id: Id5e5b284587da1e7fdfd00baa9c899626832a113 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use OpenType font weightsJonas Karlsson2020-08-281-2/+2
| | | | | | | Task-number: QTBUG-42248 Change-Id: Icdb301b27d6699c2b842c4563fbef9df73c23cbc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Allow arbitrary baseline shift in QTextCharacterFormatJordi Pujol Foyo2020-08-261-0/+87
| | | | | | | | | | | | | | | Added 6 new methods in QTextFormat and QTextDocument to allow setting/getting specific % positioning for baseline and super/ subscript. Modified QTextLayout to honor those new settings. [ChangeLog][QtGui][QTextLayout,QTextFormat,QTextDocument] Allow text layout modification based on baseline offset and super/subscript % height positioning Fixes: QTBUG-18260 Change-Id: I0796f18224aac8df6baf8359c35022fd98fe64ef Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-3/+3
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Export the letter and word spacing settings set on the default formatAndy Shaw2020-07-061-0/+18
| | | | | | | | | | | | When the default format has letter and word spacing set then these should be exported in the HTML's body tag. This also adds support for the reading of letter-spacing and word-spacing set too, so that the same html outputted can be read back in. Fixes: QTBUG-83718 Change-Id: Ic4afca21eb05efb779dbf99c6b3c13373e851f15 Pick-to: 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port QtGui from QStringRef to QStringViewLars Knoll2020-06-111-3/+3
| | | | | | Task-number: QTBUG-84319 Change-Id: I1761096fbcc9421a013cf73f831a2a2ba0c18006 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QtGui: fix deprecated QChar conversionsMarc Mutz2020-05-111-3/+3
| | | | | | | | | Conversions from non-char-types to QChar are going to be deprecated. Use QChar::fromUcs2(), fromUcs4(), QLatin1Char(), or convert the constructor argument to char16_t. Change-Id: Ib45ebd5560aa3a2bc460037ab09773607485c6e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move Qt::codecForHtml() to qtextcodec.*Lars Knoll2020-04-241-16/+0
| | | | | | | | The method should move out of Qt together with QTextCodec in Qt 6. Qt 6 will in any case always assume utf8 for 8bit encoded HTML. Change-Id: I68adbc1f0df7e36a82ef6b434ee3771f23e3b790 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>