summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* QIconEngine: add comment about Qt7 changesHEADdevChristian Ehrlicher32 hours1-0/+1
| | | | | | | | | The virtual function pixmap() and scaledPixmap() should be merged in Qt7 as they only differ in the additional 'qreal scale' argument which should be passed every time nowadays. Change-Id: I463250cdbf8ef81f8efa78665a52b0dd49f5c107 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QPixmap/QImage: remove outdated \since commentsChristian Ehrlicher32 hours2-18/+0
| | | | | | | | Remove all \since comments predating Qt5.0 since they are of no value anymore. Change-Id: I76f56a88f7da97ff4b6cadd5fee6bd3cc5d93052 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* ColorScheme: make QStyleHints::colorScheme writable for applicationsVolker Hilsheimer4 days4-3/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applications can request the color scheme to be either explicitly light or dark, or to follow the system default by setting the scheme to Qt::ColorScheme::Unknown. Setting the color scheme will make the request to the QPlatformTheme implementation, which can then use the appropriate implementation to set the application's appearance so that both palette and window decoration follow the requested color scheme. This should trigger theme change and palette change events. A change to the effective scheme should then call back into QStyleHintsPrivate::updateColorScheme, which will emit the changed signal for the property. Implement this for macOS (Cocoa), iOS, Android, and Windows. On macOS, we have to use deprecated AppKit APIs; the replacements for those APIs are not suitable for this use case. On iOS, the setting is for each UIWindow, which we can update or initialize based on an explicitly requested scheme. On Android we can piggy-back on the logic added when dark theme support was introduced in b4a9bb1f6a40e6d504c1f48f0d9ea2b70ab1a9f0. On Windows, we have to fake a dark palette if the dark scheme is requested on a light system, as there is no API to read a dark palette. However, we also have to ignore any application preference if a high- contrast accessibility theme is selected by the user (we report the color scheme as unknown; there are both light and dark high-contrast themes), and read the system palette using the GetSysColor API, which is used for light mode. And we need to initialize windows with the correct frame if the application explicitly overrides the system color scheme. Add an auto-test to the QApplication test, as that gives us the most coverage to confirm that QStyleHints emits the changed signal, and that Theme- and PaletteChange events are received by the toplevel widget when the color scheme actually changes. This test has to be skipped on platforms where we cannot set the color scheme programmatically. Add the option to explicitly select the color scheme to the widget gallery example, and default it to dark mode. Fixes: QTBUG-124490 Change-Id: I7302993c0121284bf9d3b72e3149c6abbe6bd261 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Mark QGuiApplication::platformName property as CONSTANTKai Uwe Broulik5 days1-1/+1
| | | | | | | | | It cannot change at run-time once the platform has been initialized. Pick-to: 6.7 Change-Id: Ib5ec049d799cbc54f184ebc8a6531f22c02b6b5b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTextDocument: Add support for responsive imagesCarl Schwan6 days7-7/+87
| | | | | | | | | | | | | | | | 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>
* QWindowPrivate::setFocusToTarget: Add focusReason parameterDoris Verria6 days1-1/+1
| | | | | | | | | The focusReason is also important when setting focus to the target, so ammend 8c44064f62b9e57dacdf1dbd8de57e07c938b9db and add this parameter to the virtual method. Change-Id: Id7800a366cbc1ce2ac26b3fec1e47ec9267a57bb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* doc: Update note about variable axes on WindowsEskil Abrahamsen Blomfeldt6 days1-3/+1
| | | | | | | | Since Qt 6.8, the DirectWrite backend is the default, so we need to invert the warning. Change-Id: I0d32c06c3507664ecd5b1bc3ae3fcabeedee12b7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Replace deprecated MTLRenderPipelineDescriptor.sampleCountTor Arne Vestbø7 days1-1/+1
| | | | | Change-Id: I47c64416e9ba089c2f23dcebf63a26988bb1d0a7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix test compilation issues with QtLite configurationJari Helaakoski7 days3-3/+7
| | | | | | | | | | 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>
* rhi: metal: Reduce staging copy size for full-width texture uploadsLaszlo Agocs10 days1-6/+7
| | | | | | | Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-120565 Change-Id: I3f11796e0cfd7261885cec04695665b2266082f8 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: gl: Avoid a copy in partial texture uploadsLaszlo Agocs10 days1-1/+9
| | | | | | | Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-120565 Change-Id: I7f1f8c42b98c5743708c4ff80e401070d8ab24ac Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Update macOS URL handling documentationJuha Vuolle10 days1-4/+5
| | | | | | | | macOS has now similar support for https and custom uri schemes as iOS. Fixes: QTBUG-124340 Change-Id: Ie17237c9625bac5cf110f06df99f1b94bf5ded42 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update QStyleHints::colorScheme before updating palettesVolker Hilsheimer11 days1-4/+4
| | | | | | | | | | | | | | | | | The code polshing palettes needs to be able to rely on an updated value of the color scheme as reported by the QStyleHints, otherwise styles might apply the incorrect polishing logic. Update the style hints as part of processing theme change handling, and do it as the first thing, before updating the palette. Pick-to: 6.7 Task-number: QTBUG-124490 Change-Id: I393faa57ecfa6da94497ae93a4e8b5d2782ec42a Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove QGuiApplicationPrivate::colorScheme()Volker Hilsheimer11 days2-15/+3
| | | | | | | | Use the platform theme or QStyleHints instead. Task-number: QTBUG-124490 Change-Id: Iab12faa726d3031d6a250664468dac333c2c2e0c Reviewed-by: Doris Verria <doris.verria@qt.io>
* rhi: gl: Clean up UNPACK_ROW_LENGTH handlingLaszlo Agocs11 days2-3/+9
| | | | | | | | | Be consistent and do not attempt to set GL_UNPACK_ROW_LENGTH on GLES 2.0. Have an appropriate flag in caps. Task-number: QTBUG-120565 Change-Id: I7b4db49480c2225b11807681d9bc77d2f2615e30 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: metal: Handle multiview with depth attachment onlyLaszlo Agocs11 days1-2/+8
| | | | | | | | | | Copy the approach added for Vulkan. (no color attachments, but depth texture array is present -> assume this means multiview rendering and use the array size as view count) Change-Id: Ie523b54e8eec6fdd4fe5f203d1ea97b366f8ac00 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Fix multiview with depth attachment onlyLaszlo Agocs11 days2-6/+10
| | | | | | | | | | Also change a confusing argument naming (begin-end vs. first-last). Relevant in particular for the depth texture generation pass of Qt Quick 3D (XR) with multiview rendering enabled. Change-Id: I18746581cddfa96127de2d07853164b1c88b070b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: vulkan: Reduce staging copy size for full-width texture uploadsLaszlo Agocs11 days1-6/+6
| | | | | | | Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-120565 Change-Id: I057f40ee410df35af87f27a0357252bc26234f04 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QPageSize: remove redundant operator== declarationVolker Hilsheimer13 days2-0/+13
| | | | | | | | | | | | Amends a45a3b1ece490bcae5cccd858dbe11408a19bee0, which added the hidden friend as an inline function, without removing the already existing declaration. Since that declaration was exported, keep it in the ABI via Q_REMOVED_API, and only remove it from the API. Fixes: QTBUG-115583 Pick-to: 6.7 Change-Id: I169b565ed02168248f96c1379f537b90b4ea481c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Improve default style of QTextTableCarl Schwan13 days1-1/+2
| | | | | | | | | | 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ø2024-04-291-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QWindowPrivate: Introduce virtual setFocusToTargetDoris Verria2024-04-271-0/+10
| | | | | | | | | | | | | | | | | When a window gains focus, the focus will be set to the focusWidget, if one exists, in the case of QWidgetWindow, and to the window's contentItem's subFocusItem, in the case of QQuickWindow. However, we want to be able to customize this as we may want to set the focus item/widget to the first, last, prev, or next, depending for example, on the reason the window got focus. Eg.: on a TabKey we want to focus the next focus object, on a BackTabKey the previous one, and so on. To be able to do this, add a virtual method in QWindowPrivate that sets focus to the specified item, and override for QWidgetWindowPrivate. Task-number: QTBUG-121789 Done-with: axel.spoerl@qt.io Change-Id: Ib5e17d6ff52c2323a4013c80bf411e92b4c8ce9b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* metal: Tie drawable's MTLTexture lifetime to MTLCommandBufferTor Arne Vestbø2024-04-261-0/+10
| | | | | | | | | | | | | | By default we define QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES, which means we create MTLCommandBuffer via commandBufferWithUnretainedReferences. In this case, if Metal API validation diagnostics is enabled in Xcode, the texture is released before the command buffer is done with it, so we manually ensure the lifetime of the texture extends until the command buffer is complete. Pick-to: 6.7 Change-Id: I9b9efa96b4a004f43e0b72144aafc4b440c7fbb4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QColorTransferTable: de-duplicate inverse lookup codeAllan Sandfeld Jensen2024-04-261-31/+23
| | | | | | | | | As a drive-by, drop the unnecessary floor() and just truncate. These operations are the same for positive numbers, and by the time we reach the code, we have already checked and dealt with negative numbers. Change-Id: I3e99438f11e3a6c7862b8592b7bb4ddda1b33666 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Introduce optional smarter font merging with ContextFontMergingEskil Abrahamsen Blomfeldt2024-04-2615-64/+150
| | | | | | | | | | | | | | | | | | | | | | 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>
* ColorScheme: remove unused QWindowsApplication::isDarkModeVolker Hilsheimer2024-04-252-11/+1
| | | | | | | | | | It unnecessarily duplicates and distributes logic for reporting whether the application should run in dark or light mode. Task-number: QTBUG-124490 Change-Id: I227660cf3e1f21afd5fd9b3d6452f6109f3cf799 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
* Layouts: Compile fix #ifdeffed out debug codeJan Arve Sæther2024-04-251-2/+2
| | | | | Change-Id: I1e7ffe1b27688e6d2258af4dcea1b32f02f73923 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* print: Clamp margins entered by the user in the page setup dialogJarkko Koivikko2024-04-253-51/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | 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>
* Tighten CMYK ICC parsingAllan Sandfeld Jensen2024-04-231-0/+7
| | | | | | | Must include a CLUT Change-Id: I790e0c86d4cdbcfbcfda9e35c7689090f44711a6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* ColorScheme: clean up code to prepare adding a setterVolker Hilsheimer2024-04-234-6/+10
| | | | | | | | | | | | | | | | | | | The current QStyleHintsPrivate::setColorScheme is called when the system theme changes, handling the change and informing the application. It is not a setter. When we add a public setter, that setter will have to go through the QPlatformTheme to request an override for the application. That will then result in a call back to the QStyleHints to update the theme with the effective color scheme (or ignore the request for the override, on some platforms). Rename it (and similar misleading APIs in platform plugins) to updateColorScheme, and adjust outdated comments in some of the platform plugins. Task-number: QTBUG-124490 Change-Id: I6a852211254993df86acf2e2d42cf345e7401f4f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Gui: fix memory leak in QGuiGLThreadContextTim Blechmann2024-04-231-0/+3
| | | | | | | | | | | | | | `QCoreApplicationPrivate::cleanupThreadData` calls `~QGuiGLThreadContext`, which calls `QOpenGLContextPrivate::setCurrentContext`, which creates a new `QGuiGLThreadContext`, which is not destroyed anymore. since `~QGuiGLThreadContext` sets a nullptr we exit early. Fixes: QTBUG-124538 Pick-to: 6.7 Change-Id: I51e40fcf8fd1169a4dfd336fac9c82f44d42f68e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Update the cached DPR on QWindow update requestMorten Sørvig2024-04-221-0/+9
| | | | | | | | | | Follow-up from commit 299dfe which added a similar update for expose events. This fixes missing DPR updates for exposed windows. Pick-to: 6.6 6.7 Change-Id: Ic1a9a41bd979270b97303abb71f1230bff001d19 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QTextFormat: Use QMap::constFind() to avoid unnecessary detachesVladimir Belyavsky2024-04-211-8/+8
| | | | | | | | Use QMap::constFind() instead of non-const QMap::find() where applicable to avoid unnecessary detaches. Change-Id: I76113c00efabb592f565f3ba4c90aefead1ac6a0 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Reverse fontconfig dominance logicAllan Sandfeld Jensen2024-04-191-40/+62
| | | | | | | | | | | | | | | | | | This changes four things: 1. The detection of Xft using platforms is now reversed assumed true, unless the desktop environment is traditionally Qt based. 2. When Xft using platforms are detected the Xft settings win over fontconfig settings. 3. On other platforms, Xft settings can still be used as a fallback if no fontconfig settings are found. 4. In case of no fontconfig match Xft settings are now applied, where before they would never be. Fixes: QTBUG-43745 Change-Id: I52372a6e2315441668eaf384046514fd6653e64a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QWindow: Persist foreign winId to support destroy/create cyclesTor Arne Vestbø2024-04-192-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Draw list bullets/numbers with CSS text color, not palette colorShawn Rutledge2024-04-191-5/+3
| | | | | | | | | | | | | | | | | | | | | When CSS has been used to customize the text color, render the bullet with the same color. This is consistent with web browsers, and with Qt Quick rendering. In QTextDocumentLayoutPrivate::drawListItem(), the pen color is the text color, so use it instead of brush color. Add a baseline test for lancelot: the background and general text are customized, then some list items are customized further, and some of them have colored text spans. Repeat with different styles of numbered and bullet lists and checklists. Fixes: QTBUG-2188 Task-number: QTBUG-213 Task-number: QTBUG-57833 Pick-to: 6.5 6.7 Change-Id: I71e84d00172e4b37aef57c8badd2ec43c10113d9 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Copy image offset in copyMetadataAllan Sandfeld Jensen2024-04-181-4/+2
| | | | | | | | Making it be carried more consistently. Pick-to: 6.7 Change-Id: I8d2da1264a59febbd44bbcff798b647ec2813bb0 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Gui: Add Q_GADGET to QPointerEventUlf Hermann2024-04-181-0/+1
| | | | | | | | | | It's exposed in the QPointingDevice::grabChanged signal. In order to build a complete graph of metaobjects via properties and methods we need to know about all argument and return types as metaobjecs. Such a graph is desirable for reasoning about the consistency of the type system. Task-number: QTBUG-101143 Change-Id: Ib8eca9490504846ae96814f7d746084adf6a29f9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Convert "(added in)" enum warnings to [since] syntaxAllan Sandfeld Jensen2024-04-182-31/+52
| | | | | | | | | | With the since syntax we can now mark since more standardized Pick-to: 6.7 Change-Id: I3c53010043a40e8887f1899cde2689ee80e530ae Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* Add API to provide user-defined fallback fontsEskil Abrahamsen Blomfeldt2024-04-183-1/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QColorVector: make the (QPointF) ctor a named oneMarc Mutz2024-04-182-22/+20
| | | | | | | | | | | | | | | | | | | | Instead of an explicit ctor, make conversion from QPointF an explicitly-named ctor. This prepares the class for being converted to a pure struct, alleviating its use in arrays without the additional QUninitialized kludge that Coverity doesn't seem to understand. Amends 78a7e54f8f5c4ca6ce1ee6b0ac82c42b21738ac5. As a drive-by, take the QPointF by value, fixing clazy-function-args-by-value. Coverity-Id: 444249 Coverity-Id: 425860 Change-Id: I925e94b21bf041a6fb03c56ef9a2da85d8285982 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support rendering CSS 'border' property for html tableSanthosh Kumar2024-04-183-12/+42
| | | | | | | | | | | | 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>
* Avoid overflows in gradient calculationsEirik Aavitsland2024-04-181-25/+44
| | | | | | | | | | | | Avoid the optimized fixed-point function for vertical gradients if the parameters are out of range for that. Fall back to the general gradient function in that case. Fixes: QTBUG-120331 Pick-to: 6.7 6.5 6.2 Change-Id: Idf116f0077403531d9ea414e3043fdc92b6fe4a9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add preliminary support for Qt for visionOSTor Arne Vestbø2024-04-188-24/+21
| | | | | | | | | | | | | | | | | | | | | | Qt already runs on Vision Pro as "Designed for iPad", using Qt for iOS. This change enables building Qt for visionOS directly, which opens the door to visionOS specific APIs and use-cases such as volumes and immersive spaces. The platform removes some APIs we depend on, notably UIScreen, so some code paths have been disabled or mocked to get something up and running. As our current window management approach on UIKit platforms depends on UIWindow and UIScreen there is currently no way to bring up QWindows. This will improve once we refactor our window management to use window scenes. To configure for visionOS, pass -platform macx-visionos-clang, and optionally add -sdk xrsimulator to build for the simulator. Change-Id: I4eda55fc3fd06e12d30a188928487cf68940ee07 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* qicc: avoid double lookupAnton Kudryavtsev2024-04-171-8/+8
| | | | | Change-Id: I9da3b37927650ab9dee928156f907ea5c58fc500 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make possible code-paths assertedAllan Sandfeld Jensen2024-04-171-21/+21
| | | | | | | Makes it more obvious to code-checker what is possible. Change-Id: I8b2bbc55a600e8b570644135867a3244c6d57be7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Long live [[nodiscard]] QFile::openGiuseppe D'Angelo2024-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having already caught some bugs in real code because of unchecked calls to QFile::open, this commit marks QFile::open (and open() in other file-I/O classes) as [[nodiscard]]. Since it's going to raise warnings, the plan is to keep the existing behavior up to and including the next LTS. Then the warnings will switch on by default. All of this is protected by system of macros to opt-in or opt-out the behavioral change at any time. A possible counter-argument for doing this is that QFile::open is also used for opening files in the the resource system, and that opening "cannot fail". It clearly can, if the resource is moved away or renamed; code should at a minimum use a Q_ASSERT in debug builds. Another counter-argument is the opening of file handles or descriptors; but again, that opening may fail in case the handle has been closed or if the flags are incompatible. --- Why not marking *every* open() override? Because some are not meant to be called directly -- for instance sockets are supposed to be open via calls to `connectToHost` or similar. One notable exception is QIODevice::open() itself. Although rarely called directly by user code (which just calls open() on a specific subclass, which likely has an override), it may be called: 1) By code that just takes a `QIODevice *` and does something with it. That code is arguably more rare than code using QFile directly. Still, being "generic" code, they have an extra responsibility when making sure to handle a possible opening failure. 2) By QIODevice subclasses, which are even more rare. However, they usually ignore the return from QIODevice::open() as it's unconditionally true. (QIODevice::open() doesn't use the protected virtual pattern.) I'll try and tackle QIODevice in a future commit. [ChangeLog][QtCore][QFileDevice] The open() functions of file-related I/O classes (such as QFile, QSaveFile, QTemporaryFile) can now be marked with the "nodiscard" attribute, in order to prevent a category of bugs where the return value of open() is not checked and the file is then used. In order to avoid warnings in existing code, the marking can be opted in or out, by defining QT_USE_NODISCARD_FILE_OPEN or the QT_NO_USE_NODISCARD_FILE_OPEN macros. By default, Qt will automatically enable nodiscard on these functions starting from Qt 6.10. Change-Id: Ied940e1c0a37344f5200b2c51b05cd1afcb2557d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Warn on setHighDpiScaleFactorRoundingPolicy misuseMorten Sørvig2024-04-171-0/+2
| | | | | | | | | | | | | | The rounding policy is used to calculate QScreen geometry during startup. Changing it afterwards is not supported since we don't have an update mechanism. This restriction is already documented but printing a warning makes sense since this is easy to miss. Fixes: QTBUG-123102 Change-Id: Ib88511e61abbf97436a13dc5d38d3d1fbd5aab2c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qicc: avoid implict detachAnton Kudryavtsev2024-04-171-1/+1
| | | | | | Change-Id: I3bca1460257ddb44004e85d153351fba52b0c8c3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>