summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Always call setParent during QIOSWindow constructionTor Arne Vestbø20 hours1-0/+6
| | | | | | | | | | | | | We rely on setParent for parenting top level windows into our desktop manager view, so we can't condition the call on having a parent window, like we do on other platforms. This was a regression from 988039729f55a5e62e32b82c6f29ff7457e91d9d. Fixes: QTBUG-125142 Pick-to: 6.7 Change-Id: I2884d77db09cba5371ccd77eabda7ce38c0292de Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QTextDocument: Add support for responsive imagesCarl Schwan43 hours1-1/+65
| | | | | | | | | | | | | | | | Add support for the max-width css attribute in image. This allows images to be responsive: it adapts their size to the size of the QTextDocument so that they never grow bigger than the QTextDocument pageSize. This is implemented for the image handler used in QTextEdit and other QtWidget text related classes. [ChangeLog][QtGui][CSS] The max-width style can now be applied to <img/> to set the maximum width in pixels or percentage. Task-number: QTBUG-12283 Change-Id: Ic94e16279a1240ab4a509823de59dc0bfc920bb9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix test compilation issues with QtLite configurationJari Helaakoski3 days14-13/+132
| | | | | | | | | | Now developer build tests compile, but some are not working. Functional fix will come later via separate tasks. Task-number: QTBUG-122999 Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve default style of QTextTableCarl Schwan9 days1-14/+14
| | | | | | | | | | Collapse the border and add some padding for the table cells. [ChangeLog][QtGui][Text] QTextTableFormat now defaults to collapsed tables with no spacing between cells. Change-Id: Ibebc92820447bd5fd9c0b905261dc4426b74358c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't quit automatically via QEventLoopLocker if there are open windowsTor Arne Vestbø10 days1-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of df359bcb703db5a8adbf14e88ba4ae0d54f0cfcd the semantics and interaction between QEventLoopLocker and QGuiApplication was changed, based on the assumption that these two mechanisms were independent and should not affect each other. This had a surprising regression where the use of QEventLoopLocker in combination with the QCoreApplication::isQuitLockEnabled() automatic quit would end up quitting the app, even if it had open windows, for example when the last job of some internal job queue finished. It could be argued that if the app has open windows that should not be closed, they should ignore the Close event, and that an application with running QEventLoopLocker jobs should maintain an active window showing the progress of those jobs, but still, this is regression that we want to fix. We now bail out if !lastWindowClosed() in QGuiApplication's canQuitAutomatically, which is triggered from QEventLoopLocker's isQuitLockEnabled() behavior. And we do so regardless of whether quitOnLastWindowClosed is set or not, as the latter property determines the behavior when closing a window, not the behavior when a QEventLoopLocker goes out of scope. Similarly, we now block quitting of the application when triggered by quitOnLastWindowClosed() if a QEventLoop is active, regardless of the isQuitLockEnabled(), as the latter property is determining whether we should trigger a quit, not whether we should block them. [ChangeLog][Important behavior changes] Fixed a regression where the last QEventLoopLocker going out of scope would quit the app, even if there were open windows, if quitOnLastWindowClosed was false. [ChangeLog][Important behavior changes] Fixed a regression where closing the last window would quit the app, even if there were active QEventLoopLockers, if isQuitLockEnabled was false. Fixes: QTBUG-124386 Pick-to: 6.7 6.5 Change-Id: I84fd0ddea78a2f417f3a17b326113c880079cf85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce optional smarter font merging with ContextFontMergingEskil Abrahamsen Blomfeldt13 days1-2/+2
| | | | | | | | | | | | | | | | | | | | | | This introduces an optional, slightly more expensive approach to font merging which takes the full string into account, instead of just going character by character. This addresses the issue that you may sometimes get multiple fonts to cover one string of text in a single language. With Chinese, this is especially an issue because many fonts will only support parts of the very large character set. The new algorithm detects if the string was incompletely covered by the font and tries the fallback fonts in order to find the best match. This is obviously more expensive, especially if no perfect match is found and we have to check all the fallbacks in the list, but it is opt-in and only enabled if the ContextFontMerging flag is set. Task-number: QTBUG-121131 Change-Id: I8c7874d0918640bd83418e3c4726c89f43a220a3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* print: Clamp margins entered by the user in the page setup dialogJarkko Koivikko2024-04-251-3/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current functionality discards all margins if any values fall outside the minimum or maximum limits. This can confuse and frustrate users since the Windows native page setup dialog doesn't enforce minimum values. Introduce a new parameter outOfBoundsPolicy for the set margins functions in the QPageLayout: - OutOfBoundsPolicy::Reject The old behavior rejecting out of bounds values. - OutOfBoundsPolicy::Clamp The new behavior for clamping the values. The OutOfBoundsPolicy is applied only in StandardMode to maintain backwards compatibility in FullPageMode, where all margins are accepted. Use the new Clamp policy in the printsupport where the clamping is necessary. Maintain binary compatibility by putting the declaration of the old symbols without policy parameter behind QT_GUI_REMOVED_SINCE, and implement them in removed_api.cpp to call the new versions. Task-number: QTBUG-122410 Change-Id: I06aee292c1daff2863502f471b03798dafbcd81b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMovie: fix regression in frame delaysEirik Aavitsland2024-04-241-0/+12
| | | | | | | | | | | | | The recent addition of support for multi-frame (non-animation) formats had an unwanted side effect of sometimes calling QImageReader::nextImageDelay() when the reader is at a different frame than intended. Fix by effectively reverting to the previous call pattern. Fixes: QTBUG-124227 Pick-to: 6.7 6.5 Change-Id: I735f8d67afb17bd4c77f9b4507a71796b7d66958 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use QCOMPARE_GE/QCOMPARE_LEAllan Sandfeld Jensen2024-04-191-31/+31
| | | | | | | It gives us more information on failures Change-Id: I1e8e32e7f6ab3bd55201f6d15efc6b60ad7db4f3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tst_QColorSpace::imageConversion(Adobe RGB -> Display-P3): increase toleranceTor Arne Vestbø2024-04-191-1/+1
| | | | | | | | The tolerance is too low, and fails with Xcode 15 builds of Qt. Pick-to: 6.7 Change-Id: I5755d33b052a43eb4af7ea29ec54746f73e3c42c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QWindow: Persist foreign winId to support destroy/create cyclesTor Arne Vestbø2024-04-191-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | We used to set a private _q_foreignWinId property on QWindow when creating foreign windows, and this was the mechanism which we then passed the foreign winId to the platform plugin. With c585802e946d97e7d177ea334a162dc7bc286b84 this was removed, since we now were passing the winId through via explicit QPA APIs, and since 0c6911e5cde24c45d6f2c08b6e71064bdd1eccfa removed the ability to explicitly destroy() a foreign window. But when closing a QWindow, we destroy both the window itself, and all its children, including foreign windows. In this case we still want to support recreating the foreign window, for example when the parent window is shown again. To enable this we restore the _q_foreignWinId private property, but keep the limitation of not being able to explicitly destroy a foreign window. Pick-to: 6.7 6.5 Fixes: QTBUG-124160 Change-Id: Ia885ba9f043e64fb21eedd2b4c344679726f1b5c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add API to provide user-defined fallback fontsEskil Abrahamsen Blomfeldt2024-04-181-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When depending on Qt's font merging for providing glyphs for certain languages, there are currently some drawbacks. For one, you will typically get a system font which might not fit together with the main font of the application. In addition, you might get some glyphs from one font and other from another (typically for Chinese where the character sets are so large that fonts will often only implement parts). And finally, you may get the wrong glyphs for writing systems with regional differences, if your application is e.g. written in Japanese and then run on a Chinese system, you might get Chinese versions of characters which are shared between the languages. Without language-based font matching in Qt, there's no silver bullet for fixing this. This patch introduces API which makes it possible for users to provide the solution themselves, either by selecting application-provided fonts as fallbacks for certain scripts or by hardcoding system fonts for a specific language. [ChangeLog][Fonts] Added API to override default fallback font families for specific scripts. Task-number: QTBUG-121131 Change-Id: I23ee17b7dfe1c1e481c87cc67a05a0522841b598 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Support rendering CSS 'border' property for html tableSanthosh Kumar2024-04-181-0/+68
| | | | | | | | | | | | We supported CSS 'border-width', 'border-style' and 'border-color' for HTML tables since 8a9bec35fb0c60a0e5990c1a12ffe6f39fdbf2d. Now we also support the 'border' property, which is shorthand to set all four borders' width, style and color. Fixes: QTBUG-123167 Pick-to: 6.7 6.6 Change-Id: I5f29b94ab9facf412a9c230d554efb5c69368b6b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Tests: make some QFile::open calls failGiuseppe D'Angelo2024-04-131-1/+2
| | | | | | | | | | In some cases calls to QFile::open are made outside of a testfunction (so we can't use QVERIFY), or even in standalone executables that are executed by tests. Make them fail "visibly". Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add CMYK support to QColorSpaceAllan Sandfeld Jensen2024-04-125-4/+93
| | | | | | | | [ChangeLog][QtGui][QColorSpace] Support for CMYK color spaces has been added. Change-Id: I2c684dbeee8b97fc90ca4e2a892349a7fa465d06 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QFileSystemModel: Add role for fileinfoSune Vuorela2024-04-111-0/+1
| | | | | | | | | | Instead of having users traverse a ProxyModel hierarchy to get to a QFileSystemModel to use the fileInfo(QModelIndex) function, just let it be available with the roles. Change-Id: I285347d1d85b4c6253fcb893737aa629a56e27fd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Revert "Android: SKIP cases failing on Android 12 CI with 16GB RAM"Assam Boudjelthia2024-04-051-16/+0
| | | | | | | | | | | | | | | This partially reverts commit eb0d7b5dcf834c856d58637ada8745aee2b040ee. Leaving tst_QRhi::tessellation() skipped because it still fails. Reason for revert: The latest emulator fixed the issue. Fixes: QTBUG-111235 Fixes: QTBUG-111236 Task-number: QTQAINFRA-5971 Pick-to: 6.7 6.6 6.5 Change-Id: I9a624be6ba219a4175c0e84ba68d882953422cba Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
* Revert "Skip Vulkan on Android in QRhi autotest"Assam Boudjelthia2024-04-051-2/+1
| | | | | | | | | | | | This reverts commit 0d413506a1b019efecff41318a9134d79f2abcd1. Reason for revert: Latest emulator fixed the issue. Task-number: QTBUG-118220 Task-number: QTQAINFRA-5971 Pick-to: 6.7 Change-Id: I0d4792ef68a3ad840c8c353f55cb96d0be7cd66e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Revert "Skip QVulkan autotests on Android"Assam Boudjelthia2024-04-051-7/+27
| | | | | | | | | | | | This reverts commit c6138bf9de411450cbadf9576a256296b5917e01. Reason for revert: latest emulator version fixed the issue. Task-number: QTBUG-118234 Task-number: QTQAINFRA-5971 Pick-to: 6.7 Change-Id: I7137851baf2b71e760af4bfab7726d761b7f59ff Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Make QColorTrcLut more flexibleAllan Sandfeld Jensen2024-04-051-3/+5
| | | | | | | | Make it possible to generate one way QColorTrcLut tables, and make it easier test out different table size, Change-Id: I953c68d772699de87fdddbf15ce196e6ba8b9898 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add color space model, making gray color spaces explicitAllan Sandfeld Jensen2024-04-052-1/+249
| | | | | | | | | This also adds image conversion of both format and color space, which will also be required later for conversions to CMYK formats and color spaces. Change-Id: I578c0a010ffcdb4df4cf9080c0621fac8bc342bf Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Port QImage::Format_CMYK32 to CMYK8888Giuseppe D'Angelo2024-04-043-12/+12
| | | | | | | | | | | | Follow the established convention that byte-oriented image formats have the "8888" suffix, not "32". The old enum name is temporarily left to help port other submodules. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I4b6f10cb22312b614cb9cf4b0ac439907276c538 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add support for CMYK file I/O in JPEGGiuseppe D'Angelo2024-04-031-20/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JPEG part 6 defines CMYK support. This commit adds such support to the JPEG plugin. A *very* interesting discovery is the fact that Photoshop inverts the meaning of the CMYK color channels when saving into JPEG: 0 means "full ink", and 255 means "no ink". Most other image viewers/editors follow the same interpretation, I imagine for compatibility. But others, like Adobe Reader, don't (???) -- a PDF expects a DCT encoding with 0 meaning "no ink". I am adding a SubType to the image I/O handler to let the user choose what they want, defaulting to Photoshop behavior. Also, turns out that Qt was already loading CMYK files and converting them to RGB. I don't think we should do automatic, lossy conversions (we were not taking into account an eventual colorspace...), so I'm changing that loading to yield a CMYK QImage. Finally: save the colorspace, even if it's a CMYK image. QColorSpace doesn't support anything but RGB matrix-based colorspaces. Yet, it can load an arbitrary ICC profile, and will store it even if it's unable to use it. We can use this fact to preserve the colorspace embedded in CMYK images, or let users set an arbitrary ICC profile on them through Qt APIs, and then saving the result in JPEG. [ChangeLog][QtGui][JPEG] Added support for loading and saving of JPEG files in 8-bit CMYK format. When loading a CMYK JPEG file, Qt used to convert it automatically to a RGB image; now instead it's kept as-is. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Ibdbfa16aa35814f5dba28c2df89577175162b731 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* rhi: Add support for resolving depth-stencilLaszlo Agocs2024-04-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add setDepthResolveTexture(). Should work similarly to the color attachments' resolveTexture, but for depth or depth-stencil. However, this is another fragmented feature. - D3D11/12: Not supported. AFAICS multisample resolve (ResolveSubresource) is just not supported for depth or depth-stencil formats. - Vulkan: Not supported with Vulkan 1.0. Supported with Vulkan 1.1 and the two extensions. (VK_KHR_depth_stencil_resolve which in turn requires VK_KHR_create_renderpass2 since the 1.0 structs are not extensible, so now need to use VkRenderPassCreateInfo2 and all the '2' structs) In Vulkan 1.2 the above are in core, without the KHR suffix, but we cannot just use that because our main target, the Quest 3 (Android) is Vulkan 1.1. So 1.2 and up is ignored for now and we always look for the 1.1 KHR extensions. The depth resolve filter is forced for SAMPLE_0. AVG seems to be supported on desktop (NVIDIA) at least, but that's not guaranteed, so would need physical device support checks. On the Quest 3 it does not seem to be supported. And in any case, other APIs such as Metal do not have an AVG filter mode at all, so just use SAMPLE_0 always. - OpenGL (not ES): Should work, both when the multisample data is a renderbuffer and a texture. Relies on glBlitFramebuffer with filter NEAREST. What it does internally, with regards to the depth/stencil resolve mode, is not under our control. - OpenGL ES: Should work when the multisample buffer is a texture. But it will not work when a multisample renderbuffer (setDepthStencilBuffer, not setDepthTexture) is used because the GLES-only multisample extensions (GL_EXT_multisampled_render_to_texture, GL_OVR_multiview_multisampled_render_to_texture, which we prefer over the explicit resolve-based approach) work with textures only. - Metal: Should work. Task-number: QTBUG-122292 Change-Id: Ifa7ca5e1be78227bd6bd7546dde3a62f7fdbc95e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* GUI: add CMYK painting supportGiuseppe D'Angelo2024-04-032-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a CMYK 8bpp format to QImage. The idea is to enable the transport of CMYK images inside Qt, for instance to be loaded/saved from files or painted on CMYK capable paint devices (e.g. PDF). Also, rasterization support *from* a CMYK image is added (on top of a RGB surface), as well as CMYK image scaling/conversion. Conversion and rasterization between CMYK and RGB isn't particularly optimized nor it honors any colorspaces yet. The overall idea is to match 1:1 the existing behavior of CMYK QColor (which get naively changed to RGB; there isn't colorspace support in QPainter yet). There are no plans to add rasterization *towards* CMYK. Image save/load in native CMYK formats will be added in future commits. This work has been kindly sponsored by the QGIS project (https://qgis.org/). [ChangeLog][QtGui] Support for 8-bit CMYK images has been added. Change-Id: I4b024cd4c15119c669b6ddd450418a9e425587f8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-276-11/+11
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QColorSpace::isValidTargetAllan Sandfeld Jensen2024-03-271-1/+1
| | | | | | | | To indicate color spaces that can not be used as a target, but only as a source. Change-Id: Iae79e3533599c112872d171a2f45178029be89dc Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QTextMarkdownWriter: escape all backslashesShawn Rutledge2024-03-262-1/+204
| | | | | | | | | | | | | | | | | | A literal backslash needs to be doubled so that the parser doesn't treat it as escaping the following character when the markdown is read back. In ca4774131b9b8ee40b4d7f5c1ba296af4700207f we tried to limit it to backslashes that were not already escaped. In case someone really needs a longer series of backslashes, it's more correct to escape them all; but this comes with the risk that if they do not get un-escaped by the markdown parser in some scenario, repeated round-trip saving and loading could multiply them excessively. So we also add a lot of tests to try to verify that this is safe. Task-number: QTBUG-96051 Fixes: QTBUG-122083 Pick-to: 6.7 Change-Id: I64f610d24e99f67ebdc30d5ab5c6cf3985aec5ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QMovie: allow only one dimension to be used for scaledSizeVladimir Belyavsky2024-03-201-0/+31
| | | | | | | | | | | | | | | | | In 4c21f728374605ff529aa53c63c3d59517098435 we did this for QImageReader. So, to support the same for QMovie, we just need to remove the custom (and very inefficient) scaling for frames. This should be safe since the underlying QImageReader must ensure that the returned image matches the scaled size. [ChangeLog][QtGui][QMovie] Allow only one dimension (width or height) to be set for the scaled size. In this case, the other will be calculated automatically based on the original movie size and maintaining the aspect ratio. Fixes: QTBUG-115039 Change-Id: I50979a75970c79647dbb8c8b4b121266ba033a63 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QImageReader: allow only one dimension to be used for scaledSizeVladimir Belyavsky2024-03-191-0/+57
| | | | | | | | | | | | | | | If only one dimension (width or height) of the scaled size is set by an user, let's try to calculate the second one, based on the image original size and maintaining the aspect ratio. [ChangeLog][QtGui][QImageReader] Allow only one dimension (width or height) to be set for the scaled size. In this case, the other will be calculated automatically based on the original image size and maintaining the aspect ratio. Task-number: QTBUG-115039 Change-Id: If1b13b1ead3cf788915c08bdb3ba8becd8bf8042 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add configure feature for MetalTor Arne Vestbø2024-03-191-1/+1
| | | | | | | Simplifies maintenance of code paths that rely on Metal. Change-Id: I1d1f705fffc14dbafde346eeb555b43be6d5be54 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Support foreground gradient in CSS parser and HTML generatorEskil Abrahamsen Blomfeldt2024-03-181-1/+89
| | | | | | | | | | | | | | | 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/+25
| | | | | | | | | | | | | | | 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>
* Revert "Don't do font merging for PUA characters"Eskil Abrahamsen Blomfeldt2024-03-181-39/+0
| | | | | | | | | | | | | | This reverts commit fc33fea999365c36ed446eee0db0d59d94be306b. The change caused issues with system-wide PUA fallbacks on platforms where this is supported. It needs to be replaced by an approach which still falls back, but only for fonts which are explicitly categorized as PUA fallbacks. Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-110502 Change-Id: I985a1f8076645593c50e81759872b4227d0fcd0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix QTextEngine regression with large-ish textsPaul Olav Tvete2024-03-151-0/+22
| | | | | | | | | | | | | | | Change 997fd3b88ede8078af286da6ecc197e83a8cbb46 fixed integer overflows with huge texts. This was done by using qsizetype for size calculations instead of int. However, that change introduced a serious regression due to an itermediate imultiplication result being "promoted" to unsigned, and therefore a negative value being converted to a large positive. The solution is to make sure all values in the expression are signed. Fixes: QTBUG-123339 Task-number: QTBUG-119611 Pick-to: 6.7 Change-Id: I3f9189f77b383c6103cf5b35981cdb607b065f6f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* rhi: Add basic support for specifying a view format for a textureLaszlo Agocs2024-03-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have to be able to strip the _SRGB nonsense from the render target view formats when rendering into textures that are provided from an external engine (e.g. OpenXR) and are forced onto us with formats such as VK_FORMAT_R8G8B8A8_SRGB. This highlights some limitation of the current system, which has very limited handling of sRGB stuff since proper renderers such as Qt Quick 3D have first class support for linearization and converting to sRGB at the end of their shading pipeline, so _SRGB format textures are never used in practice. OpenGL has an issue which is different from everything else, namely that we do not correctly do the glEnable/Disable on GL_FRAMEBUFFER_SRGB. The QOpenGLExtensions flag is not what we need. We need to know if the sRGB-conversion-on-write is supported or not, not that some framebuffer is sRGB-capable. So do our own query based on the desktop and the ES extension (GL_EXT_sRGB_write_control is something we never checked for, but that is the appropriate GLES extension, supported on the Quest 3 for instance) This is now corrected in the gl backend. This means that the colors will no longer be "too bright" with OpenGL ES and multiview on the Quest 3 for example. Unlike OpenGL, Vulkan and D3D automatically convert in shader reads and writes when the shader resource view or the render target view has a _SRGB format. (which we get by default since we pass on the texture format) Getting a second linear->sRGB conversion on the already sRGB data generated by e.g. Qt Quick 3D is just wrong. Allow solving this by a new function that can be optionally called to say we want (RGBA8, srgb=false), i.e. VK_FORMAT_R8G8B8A8_UNORM, for the views. Of course, reality is more complicated. D3D11 for instance does not allow "casting" a fully typed texture, we'd need to use a _TYPELESS format for that (possibly with other consequences), so skip D3D11. For D3D12 this should work from Windows 1703 on. Implementing for Metal is also left as a future exercise - it is neither needed at the moment within Qt, nor is it trivial, because view textures have to be created explicitly in Metal, normally we just work with the MTLTexture as-is, not with views. Task-number: QTBUG-122288 Task-number: QTBUG-122614 Change-Id: I8aea4e892b308d48f0bf18bdef481e460fbc9d47 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add A2B tables, and PCSLab support to QIccAllan Sandfeld Jensen2024-03-073-0/+88
| | | | | | | | | | | | | This finishes off ICC color space support in Qt (short of the optional multi process elements), and includes necessary parts for potential CMYK support (PCSLab and A2B support) [ChangeLog][QColorSpace] ICC profiles that are not three-component matrix based are now supported. Task-number: QTBUG-108175 Change-Id: Ie29b17a366d9ba0ea8135e1752530d6bb19e7520 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QTextMarkdownImporter::import(): don't crash if file has only yamlShawn Rutledge2024-03-052-2/+21
| | | | | | | | | | | If a markdown file has FrontMatter, we look for the end of the newlines after the `---` marker to begin parsing the actual markdown. But check bounds in case the file contains only front matter and not markdown. Fixes: QTBUG-122982 Change-Id: I09c4ae90c47ebd84877738aecc1d1cad0b0bfca2 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Correct license for tools filesLucie Gérard2024-03-051-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tools file should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: Icd5d5be2e04819617e68ff142924de1773bebbad Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QTextMarkdownWriter: escape special characters (line or word prefix)Shawn Rutledge2024-03-042-5/+63
| | | | | | | | | | | | | | | | | | Try to avoid writing anything that the parser would misinterpret. Escape pre-existing backslashes, but not those that are already escaped. Optimize maybeEscapeFirstChar() slightly and apply it to every line of output (except in code blocks), not only to new lines created by word-wrapping. Since it would be hard to do this without using regular expressions, the markdown writer feature now depends on the regex feature. Fixes: QTBUG-96051 Fixes: QTBUG-122083 Pick-to: 6.7 Change-Id: I8d95366501fd31441829081c668f11a3a3a23fe2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add QChronoTimer, a timer with nanoseconds precisionAhmad Samir2024-03-032-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The interval in QTimer is a QProperty of type int, which means it's limited to the number of milliseconds that would fit in an int (~24 days), this could cause overflow if a user constructs a QTimer with an interval > INT_MAX milliseconds. And it can't be easily changed to use qint64/std::chrono::nanoseconds: - changing the getters to return qint64 means user code would have narrowing conversions - the bindable QProperty interval can't be changed to qint64 during Qt6's lifetime without the risk of breaking user code - adding a new bindable QProperty that is qint64/nanoseconds is an option, but it has the complication of what to do with the int interval; set it when setInterval(milliseconds) is used by using saturation arithmetic? and what about notifying observers of the changed interval? Thus the idea of creating a new stop-gap class, QChronoTimer, as a cleaner solution. Both classes use QTimerPrivate. During the lifetime of Qt6, QTimer's interval range is about 24 days, whereas QChronoTimer's interval range is about 292 years (duration_cast<years>nanoseconds::max()). Currently the plan is to fold QChronotTimer back into QTimer in Qt7. Mark all QPropertyS in the new class as FINAL since they aren't intended to be overridden; this offers a performance boost for QML[1]. [1] https://lists.qt-project.org/pipermail/development/2024-February/044977.html [ChangeLog][QtCore] Added QChronoTimer, which uses a std::chrono::nanoseconds intervals, as a replacement for QTimer. Fixes: QTBUG-113544 Change-Id: I71697f4a8b35452c6b5604b1322ee7f0b4453f04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Copy QTimer source files to QChronoTimerAhmad Samir2024-03-031-0/+38
| | | | | | | Ultimately this is the best way to keep the log history of the code. Change-Id: I3413deffdb093a3239d65b6ca939e744224e722a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTextHtmlImporter: don't forget to appendBlock after block tag closedShawn Rutledge2024-03-011-0/+22
| | | | | | | | | | | | | | | 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>
* Add tst_QTextMarkdownImporter::paragraphsShawn Rutledge2024-02-292-0/+47
| | | | | | | | | | | | | | | Test how QTextMarkdownImporter reacts to paragraphs ending with premature LFs (created by shift-Enter in QTextEdit, for example) and paragraphs broken by Unicode LineSeparator characters. It turns out that the u2028's are retained and have the desired effect for rendering. Currently we don't distinguish auto-wrapped paragraphs from paragraphs that the user broke manually in QTextEdit (because we use a plain newline for both). Task-number: QTBUG-121475 Change-Id: Icaca4dba8be03b37ad6faa40ce1f9dfceadc48a8 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QPainterPath: detach and reset before streaming inThiago Macieira2024-02-271-0/+15
| | | | | | | | | | Otherwise we end up appending and modifying the shared object. Pick-to: 5.15 6.5 6.6 6.7 Task-number: QTBUG-122704 Change-Id: I01ec3c774d9943adb903fffd17b692c2e6d53e97 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix build without PDFAxel Spoerl2024-02-251-1/+3
| | | | | | | | | | | | tst_baseline_painting and tst_qpdfwriter rely on QT_FEATURE_pdf being enabled, without making it a condition to build the tests. Don't build the tests with PDF disabled. Task-number: QTBUG-122137 Pick-to: 6.7 6.6 6.5 Change-Id: Idbf03f30557618c83e946a80b7759cd4f6978ad5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPainter: fix assert when drawing bitmaps at very near to .5 coordEirik Aavitsland2024-02-201-0/+11
| | | | | | | | | | | | | | The code assumed that the rounding of a floating point value, and the rounding of the sum of that value and an integer, would always snap in the same direction. But because of accuracy limits (independently of the rounding function employed), that is not always the case for fractions very near to .5. Fixes: QTBUG-122451 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I0825d42e6be7f6e3397760a5e9be5dddca42dcdc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QTextMarkdownWriter: test both ways of setting font characteristicsShawn Rutledge2024-02-141-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have explicit QFont properties, and QTextFormat::setProperty(). Setting FontFixedPitch doesn't necessarily affect the view (QTextEdit or Qt Quick Text/TextEdit); and setting the font to the one we get from QFontDatabase::systemFont(QFontDatabase::FixedFont) is also unreliable, because the "monospace" fallback might actually be proportional. QTextMarkdownWriter checks for both to decide whether to use backticks; so markdown writing works if an editor UI makes the format monospace both ways to be safe. But in the opposite case that the main font is actually a monospace font, it's always been broken. The rest of the QTextCharFormat properties are generally working, to the extent that they are applicable to Markdown. But we lacked explicit test coverage: so far we were just reading Markdown or HTML and writing Markdown to test the writer. Also amend an old comment about writing underlines: writing was always possible, and since f5c7799f59ba53c634906b11e2135190093bf87b reading is supported too. So the underline support is symmetric (except that we don't heed the QTextDocument::MarkdownFeatures argument to the writer ctor: we probably should do that some day). Pick-to: 6.7 Task-number: QTBUG-54623 Task-number: QTBUG-75648 Task-number: QTBUG-75649 Task-number: QTBUG-79900 Task-number: QTBUG-99676 Task-number: QTBUG-103484 Change-Id: Iacb4ed0ea59030570702d4eadfdadfad872065c6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QTextMarkdownWriter: Don't word-wrap headingsShawn Rutledge2024-02-132-0/+10
| | | | | | | | | If it wraps, the text on the next line is no longer part of the heading. Fixes: QTBUG-106526 Change-Id: I8015c948d875c6944422ef3439e3128af5b2a2e2 Pick-to: 6.5 6.6 6.7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QTextMarkdownWriter: Avoid omitting or misplacing ending indicatorsShawn Rutledge2024-02-131-1/+83
| | | | | | | | | | | | | | | | | | | | | If we need to word-wrap a paragraph after a long formatted span, write any ending markers before the newline (amends 280d679c556ab8ead4748a627d7cd4c1950027fb ). Break before a fragment if the whole thing is past the column limit; in that case, write out any ending format markers before the newline. And now we have test coverage: prepend characters one-at-a-time to a line that already has a two-word formatted span at the end, and watch it successively break after the span, in the middle, and then before, while never putting a newline before the ending markers or failing to write them. Fixes: QTBUG-116927 Change-Id: I140e10d19a491cb599bf7ecf8514af866b5383f3 Pick-to: 6.5 6.6 6.7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>