summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Restore QActionGroup signal documentationTopi Reinio16 min.1-0/+24
| | | | | | | | | | | When QAction(Group) were moved from Qt Widgets to Qt GUI, the documentation for QActionGroup's signals - triggered() and hovered() - were erraneously dropped. Restore them. Pick-to: 6.7 6.8 6.5 Fixes: QTBUG-121586 Change-Id: I7ce5ec715c0d3df7a4f9837a0822c245063eb74d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix BT.2100PQAllan Sandfeld Jensen4 hours1-8/+8
| | | | | | | | | From and to algorithms were accidentally reversed before submitting final patch. Pick-to: 6.8 Change-Id: I16e0afda26b77047facf4f65065224c8f3dce6c6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove GENERATE_CPP_EXPORTS argumentAlexey Edelev4 hours1-1/+0
| | | | | | | | | The behavior that argument was enabling is the default one now. Pick-to: 6.8 Task-number: QTBUG-90492 Change-Id: I11711d4c794f0b22169abb595b8ffad2eeb1300d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rhi: Add D32FS8Laszlo Agocs10 hours7-0/+43
| | | | | | | | This is commonly supported in the desktop world, more commonly than D24S8. (which AMD does not like for instance) Change-Id: I43104bd9dbf28159fd8a806ff44ad5d094bdd599 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove redundant qtimer.h includesAhmad Samir25 hours1-1/+0
| | | | | | | | | | | | | | If QTimer isn't used in the file where it's included, remove the include. Fix files that depended on transitive includes. QMacPanGestureRecognizer: drive by change: classes inheriting from QObject should have Q_OBJECT macro in the definition. Change-Id: Ia8d71f4195a1ca643c9fcb14db41877413348d98 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix build error from signed/unsigned mismatchVolker Hilsheimer2 days1-1/+1
| | | | | | | | | | | | | | | When building for 32bit Android: qcolorclut_p.h:45:31: error: comparison of integers of different signs: 'qsizetype' (aka 'int') and 'unsigned int' [-Werror,-Wsign-compare] Q_ASSERT(table.size() == gridPointsX * gridPointsY * gridPointsZ * gridPointsW); ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by casting the result of the multiplication explicitly to qsizetype. Pick-to: 6.8 Change-Id: Ica9a2f9738959adfa841270ffdd4893bd7d1d4e8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix MouseButtonDblClick synthesis from touch double-tapShawn Rutledge2 days2-5/+13
| | | | | | | | | | | | | | | When QGuiApplicationPrivate::processTouchEvent() sees that the touch event was not handled, and calls processMouseEvent(), the latter uses the QEventPoint with pointId 0 regardless of the original touchpoint ID. Now it updates the persistent QEventPoint from the original touchpoint so that a double-click event will not be ruled out because of the timestamp delta or position delta (movement since press) being too large. Fixes: QTBUG-125993 Pick-to: 6.5 6.7 6.8 Change-Id: I8e9b007818107ac2329454e0ccfb2ac9e506b617 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileSystemModel: replace a TODO with QT{6,7}OnlyAhmad Samir3 days1-1/+7
| | | | | | | | | | So that it's not forgotten come Qt7. Amends 19258608e9ea02043ce9b53d4a9c99700ce49c1b. Pick-to: 6.8 Change-Id: I323f2d2738a295faa1e118c3ea7c8a5b6c6d0ac7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Logging: Introduce a macro to declare an exported Qt logging categoryUlf Hermann5 days5-5/+5
| | | | | | | | | | | | In a follow-up change we will hide Qt's own logging categories in a namespace. As a result the declaration for Qt's logging categories has to be different from the declaration for user logging categories. Introduce a separate macro to declare a logging category exported from Qt to user code/plugins/tools etc. Task-number: QTBUG-67692 Change-Id: Ia5ef5225cc0d01e6375e0d2fa1fd7367a5afedc2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIcc: fix clang's -Wimplicit-fallthroughTim Blechmann6 days1-0/+1
| | | | | | | | Clang's -Wimplicit-fallthrough is a little stricter than gcc's. Pick-to: 6.8 Change-Id: Idf933e19ab2d664885743e5db6c1fbb66c8b615e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QAction: Remove duplicated QDebug logic for handling null-actionsTor Arne Vestbø6 days1-2/+0
| | | | | | | | | | We already include the action's address by printing static_cast<const void *>(action), so no need to include the additional "0", as that just results in "QAction(0x00)". Pick-to: 6.8 Change-Id: I8ce1f5030db146a737fa73bd8f2b86e89401d345 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDataBuffer: statically assert !QTypeInfo<value_type>::isComplexMarc Mutz6 days1-0/+3
| | | | | | | | | | | | | | | | | The implementation assumes this, so assert it. I've tried the moral equivalent of is_pod first, but it turns out most of the concrete value_types aren't trivial, so let's use our own trait for now. Put the static_assert into the dtor to give users a fighting chance to Q_DECLARE_TYPEINFO before first instantiation (the dtor can usually be declared out-of-line to delay instantiation of the assertion). Change-Id: I6c03f7c554b9e07608dee639ab0abc2ddfe3c28a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* rhi: gl: Only set WRAP_R for 3D texturesLaszlo Agocs7 days1-1/+1
| | | | | | | | | | | | | | | | | It is not clear why an OpenGL implementation would reject (with INVALID_ENUM) the setting of GL_TEXTURE_WRAP_R (as making it an error makes no sense and not in the spec either), but the most likely interpretation of the associated report is that some Adreno-based Android devices do that. So instead of just testing if we are >= ES 3.0, also check the texture target before setting WRAP_R. Pick-to: 6.8 6.7 6.6 6.5 6.2 Fixes: QTBUG-126012 Change-Id: I0fe1cd71b9fd74748f7bae78030c41ca972932b5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* PaintDeviceMetric: add missing trailing commaVolker Hilsheimer8 days1-1/+1
| | | | | | | Pick-to: 6.8 Task-number: QTBUG-125859 Change-Id: Ic02cf9d021649a20b92a8fbb148c80c5913651d4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPageLayout::OutOfBoundsPolicy: add missing trailing commaVolker Hilsheimer8 days1-1/+1
| | | | | | | Pick-to: 6.8 Task-number: QTBUG-125859 Change-Id: I7834a5bd0884ab23f83813a87e9c51ab34c10797 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Doc/QIconEngine: fix comment about virtual_hook()Christian Ehrlicher8 days1-2/+2
| | | | | | | | | | QIconEngine::scaledPixmap() and isNull() are now virtual functions which can be reimplemented by the icon engines so the comment was out of date. Pick-to: 6.8 Change-Id: I308446dade1da9edeef5c554db146443660b4761 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add few qdoc \targets to QDesktopServicesJuha Vuolle8 days1-0/+2
| | | | | | | | | The targets are linked from qtnetworkauth documentation. Pick-to: 6.8 Task-number: QTBUG-125344 Change-Id: I95cc746a2dac4d8a99278c7d3ac5edf4b201a41b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QAccessibleCache: Generalize macOS-specific hooks to all Apple platformsTor Arne Vestbø8 days3-11/+11
| | | | | | | | | These are used from the iOS platform plugin as well, so rename the hooks to make it clear what's going on. Pick-to: 6.8 Change-Id: I701550a189b0047b8c604c9c27986f780aa157d4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add Identifier role to QAccessible and use it in OS interfacesJens Trillmann11 days5-29/+45
| | | | | | | | | | | | | | * Unify the default identifier creation for QAccessibleInterface on all platforms to be the same as the previous identifier on Linux. This may change some identifiers on Windows. [ChangeLog][QAccessible][QAccessibleInterface] Add possibility to add unique identifier to QAccessibleInterface to give a11y elements consistent identifiers. Task-number: QTBUG-123361 Change-Id: I8c42956a4c497e71909d71dcb27bc87433937b69 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Check D-Bus tray availability every timeIlya Fedin11 days1-9/+4
| | | | | | | | | | | It could appear in runtime, this allows applications to watch for it themselves and re-create QSystemTrayIcon as needed. Task-number: QTBUG-94871 Pick-to: 6.7 6.5 Change-Id: I10678cca4238ec0212c69155c9f22c07755ab1a8 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge applyGray, applyReturnGray, and apply methodsAllan Sandfeld Jensen11 days8-245/+247
| | | | | | | | | | Combine all into a single flexible apply method. Also fixes a few issues with RGB colorspace on gray input. Blocking CMYK colorspace on Grayscale and ElementListProcessing RGB on grayscale out. Fixes: QTBUG-125303 Change-Id: I3987010062fbb5aa708aeb1cc239f3ce9413e34f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Don't fallback to X11 tray backend on non-X11Ilya Fedin12 days1-11/+13
| | | | | | | | | | | | | This allows to have system tray support on the fly on Wayland at least where only QDBusTrayIcon is possible and no need to fallback to QSystemTrayIconSys Fixes: QTBUG-114439 Task-number: QTBUG-94871 Pick-to: 6.7 6.5 Change-Id: Ic927cde585ef02f9b9ef03f3b6338f35072bef70 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QWindowPrivate::forwardToPopup: fix QMenu touch press-drag-releaseShawn Rutledge12 days1-2/+5
| | | | | | | | | | | | | | | | | | | | | | QMenu doesn't handle touch events, but depends on mouse synthesis. QGuiApplicationPrivate::processTouchEvent() calls QWindow::forwardToPopup(), which sends it to the popup window, which sends it to QMenu. The inherited QWidget::event() calls QEvent::ignore(). It's important for forwardToPopup() to return nullptr when the event is not handled, so that processTouchEvent() goes on to create the synth-mouse event and send it to processMouseEvent(), which calls forwardToPopup() again, which QMenu::mouseMoveEvent() handles. And we also follow the usual pattern that when an event is duplicated for delivery (as a synthetic event, or just to remap it), the accepted state of the original event must be updated to reflect whether or not the cloned event was accepted. QTabletEvents are handled similarly. Amends e4ef0f03e6f1fddc397980fd7fbf6f6b829f16d9 Change-Id: I0c6c03452a5b952161c9898d84d2c17afa52fc95 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* macOS: Present Metal layer with transaction during display cycleTor Arne Vestbø12 days5-62/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When our Metal layer changes its bounds or contents scale, for example as a result of a window resize, or moving a window between screens of different device-pixel-ratios, the layer will be marked as needing display. The changes to the layer will then make their way to the screen as part of committing the root level CATransaction, managed by the macOS display cycle, which synchronizes the presentation of the bounds or scale changes to the screen's vertical sync. By default, presenting a Metal drawable to a Metal layer ignores any ongoing transactions, so the drawable ends up on the screen as fast as possible. The downside to this is that the drawable size or scale may be based on the yet-to-be presented bounds or scale changes of the layer, as these happen when the display cycle commits its transaction. To ensure that the layer properties and content changes in lock step we can enable the presentsWithTransaction property on the Metal layer. We do so selectively when the layer is asked to display, which happens during the display cycle, but not for update requests (via our display-link). This would normally be enough to ensure smooth and glitch free resizing, as long as everything happens on the main thread. Unfortunately, the [MTLCommandBuffer presentDrawable:] API we use to present a Metal drawable when rendering in response to update requests is actually scheduling the presentation on a secondary thread com.Metal.CompletionQueueDispatch queue. The result of this is that the presentation on the secondary thread might race against a presentation on the main thread initiated from the display-cycle, presenting too early, or overwriting the layer's content with stale content. To fix this we use [MTLCommandBuffer addScheduledHandler:] explicitly instead, which lets us control what happens during the presentation on the secondary thread. We then add a lock to the layer that we lock as soon as the layer needs display, and use this lock to skip presentations that should not step on the toes of the display-cycle presentation. Once the display cycle ends we unlock the lock. The lock is a read-write lock, to ensure we prioritize the main thread's display-cycle over any other presentations in case of contention. We also defer update requests if we detect that the lock is held, as there is no point in rendering a frame if we are likely not going to present it. Doing this also prevents the update-requests from starving the main thread from getting its drawables. The final case we have to account for is where the display of the layer during the display-cycle is implemented by asking another thread to do the rendering, as is the case with the Qt Quick threaded render loop. In this case the main thread is blocked while it waits for the render thread to complete drawing and presenting a frame. But the actual presentation of the Metal drawable still has to happen on the Main thread for it to be part of the display-cycle's transaction. To ensure the latter, we move the presentation of the drawable to a block, that we schedule to be run on the main thread. Once displayLayer is done with the expose event it processes the deferred presentation, on the main thread. Finally, to mitigate Qt Quick's threaded renderer running animators without any coordination with the main thread, and thereby starving it from drawables, we expose the inLiveResize property on QNativeInterface::Private::QCocoaWindow, so that the threaded render loop can step back during live resizing and drive animators via the main thread's update request. The QT_MTL_NO_TRANSACTION environment variable has been kept, as an opt-out in case the new machinery breaks somehow. It will disable the locked Metal layer, and all code paths that depend on it. [ChangeLog][macOS] Metal layers are now presented with transactions during the display-cycle, which should fix issues with the layer's content being out of sync with the layer bounds or scale. If this causes issues, set the QT_MTL_NO_TRANSACTION environment variable to opt out. Fixes: QTBUG-107198 Fixes: QTBUG-114351 Change-Id: I765e11051c3a4d44b60ff10e787589feec8917a0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* widgets: Use per-surface-format RHI support and compositorTor Arne Vestbø12 days3-37/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RHI support and compositor in QPlatformBackingStore were tied to the surface format of the top level window owning the backing store. This meant that inserting an RHI-enabled widget (QRhiWidget, QOpenGLWidget, QQuickWidget, QWebEngineView) into the widget hierarchy required recreating the top level window with a matching surface format that could support the RHI composition. It also meant that we could not have two RHI enabled widgets with different surface format requirements (Metal and OpenGL for example) in the same top level widget hierarchy. The recreation of the window had various visual side effects, such as temporarily switching out of full screen state, or the widget rendering a frame of black, as well as more serious problems such as not correctly restoring the window geometry. In addition, if client code had pulled out the winId() of the window, and did not invalidate these references on window destruction via QEvent::WinIdChange or QEvent::PlatformSurface, the client would reference stale window handles. Although this is a programming error (QWidget::winId() specifically mentions this requirement), we should avoid recreation if we can. We were already supporting flushing the backingstore to individual native child widgets, but always did so via a single RHI managed by the platform backingstore. By expanding QPlatformBackingStore to keep one set of RHI support and compositor per surface format, we can refine the logic in QWidget and QWidgetRepaintManager to not require recreating the top level. Native child widgets are then flushed independently, including any RHI textures and raster content that overlaps with the widget. We still assume that a single RHI support and compositor can be be used for multiple windows, as long as those windows have the same surface format. In the future, if needed, we can refine this to use one set per surface format e.g. Fixes: QTBUG-119221 Fixes: QTBUG-121181 Fixes: QTBUG-120096 Task-number: QTBUG-115652 Task-number: QTBUG-108344 Task-number: QTBUG-113557 Task-number: QTBUG-119309 Change-Id: I2635ed3d20c2fb76eab3b8130007dd656a0b93e5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move popup management from QApplication to QGuiApplicationShawn Rutledge12 days4-12/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to be able to have true popup windows in Qt Quick and Controls, including handling the press-drag-release sequence to select one entry from a menu or combobox. After the mouse press, a new window is created. On some platforms (such as xcb), the new window gets window system grabs of both keyboard and mouse (QApplicationPrivate::openPopup() calls grabForPopup() and it actually works); while on others, the pre-existing window continues to get the whole sequence of mouse events until the release. In the latter case, Qt needs to forward events from the original window to the popup. Until now, the list of popups was QApplicationPrivate::popupWidgets. Now we track the open popups as a list of QWindows rather than QWidgets, in QGuiApplicationPrivate::popup_list, and add a set of static functions to manage that list. Functions such as QApplication::activePopupWidget() QApplicationPrivate::openPopup() and closePopup() are rewritten to make requests to QGuiApplicationPrivate. 276943c8b791ba5897dcdb1ecfda780ac33a090b made QGuiApplicationPrivate::closeAllPopups() virtual. That is now reverted, because we're putting QGuiApplication in charge of popup management and trying to minimize widget-specific behavior. So far, QApplicationPrivate::closePopup() is still overridden to take care of focus changes. So far, QtGui does not take care of closing popups when the user clicks outside: the active popup window gets those events, and needs to close itself if the click occurs outside. An attempt to move this logic raised some issues with legacy widget test cases. Using a touchscreen to press on QMenuBar and open a QMenu, drag to a menu item and release, is temporarily broken for now. The plan is to fix it in a subsequent patch. Task-number: QTBUG-68080 Task-number: QTBUG-69777 Change-Id: I02b5034987b5ee8909917d305f414c8b0db9c7f5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Introduce flag to use typographical line metrics for fontsEskil Abrahamsen Blomfeldt12 days5-15/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For backwards compatibility reasons, font files have multiple different ways to specify vertical metrics (ascent, descent, etc.). For OpenType, the main two are the usWin* and sTypo* metrics in the OS/2 font table. The usWin* metrics are typically used as the clipping bounds of the font (so no character will ever draw outside these bounds). The sTypo* metrics thus make it possible to specify a different set of metrics for use in text layouts which is smaller than the clipping bounds (or bigger), so that you can have fonts where some characters overlap with preceding or subsequent lines. However, GDI (and thus many applications) use usWin* also for line spacing, which lead to the sTypo* metrics being untrustworthy in some fonts and later to the introduction of the USE_TYPO_METRICS in the OS/2 table version 4. The idea of this flag is to tell the font system that the sTypo* metrics can be trusted and should be preferred over the usWin* metrics. But the OpenType specification states that sTypo* metrics should *always* be preferred and modern font systems such as FreeType and DirectWrite will respect this. This in turn has lead to fonts where the USE_TYPO_METRICS flag is untrustworthy instead, i.e. the sTypo* metrics are preferable, but the USE_TYPO_METRICS has accidentally not been set. Qt trusts the USE_TYPO_METRICS flag and uses the usWin* metrics whenever this is unset. Since QFontMetricsF::height() (ascent+descent) in this case includes the line gap metric, a lot of components have been written to use it for size without adding any margins over the text. So changing the default now would break a large amount of components, including the ones in our own Windows style. Most fonts should work correctly, by setting the USE_TYPO_METRICS flag if the typo metrics are intended to be used. For those that do not, we introduce a PreferTypoLineMetrics style strategy. [ChangeLog][QtGui][Fonts] Added QFont::PreferTypoLineMetrics for using the recommended line spacing metrics of the font, even if the font has not explicitly set its USE_TYPO_METRICS flag. Fixes: QTBUG-125585 Change-Id: Ib2f7df404fe719186d78733bda26da712f1ab85a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QIcon: don't load image twiceChristian Ehrlicher12 days1-2/+5
| | | | | | | | | | | | | | QIcon::addPixmap() creates an icon engine when not yet available. During the initialization, the filename of the image is already passed to the icon engine and some (e.g. svg icon engine) already loads it. Afterwards the image is loaded again with addFile(). Avoid this by checking if the ctor of the icon engine already loaded the file and don't call addFile() afterwards in this case. Fixes: QTBUG-8151 Change-Id: I9289f17e5d703c08a82ce51ce8bded70feb6f82d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QIcon: remove redundant nullptr checkChristian Ehrlicher12 days1-1/+3
| | | | | | | Remove a redundant nullptr check found by CodeChecker. Change-Id: I03327475e1df8de27459457fc8fc2c66592889ab Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add Bt2020 and Bt2100 color spacesAllan Sandfeld Jensen12 days12-109/+463
| | | | | | | | | [ChangeLog][QtGui][QColorSpace] Bt.2020 and Bt.2100 (aka HDR10) formats have been added. Task-number: QTBUG-114722 Change-Id: I4ffce460202837e1077e34f48a9286981ee444bb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Complete color space toICC writeAllan Sandfeld Jensen12 days3-124/+620
| | | | | | | | Also write gray, CMYK and mAB RGB color space profiles. Fixes: QTBUG-125302 Change-Id: Id3b3b64537b9c08f1d40b8243c228ad111d08289 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename AT-SPI specific DBusConnection type to fix clang warningsVolker Hilsheimer12 days6-16/+16
| | | | | | | | | | | | | | | DBusConnection is forward declared as a class, and after c9e62c24440e99ace02dcceffea2ae6542f49224 we include a header that forward declares it as a struct. This triggers a warning, and also indicates that we have an ODR violation. Rename the offending type in Qt. Fixes: QTBUG-125623 Change-Id: I13ffdceec82b86910a60083aebc2afc47f9f3a4e Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Add QPaintDevice metric query to get precise fractional DPR valueEirik Aavitsland13 days7-2/+88
| | | | | | | | | | | | | | | | | | | | | For compatibility reasons, QPaintDevice needs to query subclasses for device metrics as int values. To report fractional DPR values, they have been multiplied with a large constant and divided back afterwards. However, the loss of accuracy introduced by this, though tiny, could still lead to rounding errors and painting artefacts when the values where multiplied up for large coordinates. Avoid this issue by adding a metric query that transports the full floating point value encoded as two ints. [ChangeLog][QtGui] Added new QPaintDevice metrics for querying fractional device pixel ratios with high precision. Custom paintdevice classes that support fractional DPRs are recommended to implement support for these queries in metric(). Others can ignore them. Fixes: QTBUG-124342 Change-Id: Ia6fa46e68e9fe981bdcbafb41daf080b4d1fb6d7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: enable icon engine plugins to implement themesVolker Hilsheimer14 days2-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | So far, the keys of icon engine plugins were only interpreted as the suffix of icon files, loaded via QIcon(filename). However, an icon engine could provide a lot more flexibility if it could implement an entire theme. Match the list of keys a plugin can register itself with also against the current theme name. If a matching plugin is found, use that plugin to create the icon engine. Store the factory from the plugin to avoid costly lookups for each icon. Extend the QIcon test case by adding a custom plugin that supports two themes. Since the plugin and icon engine creation infrastructure doesn't communicate which theme the plugin was created for, use QIcon::themeName to record the current theme when the engine gets created. [ChangeLog][QtGui][QIconEnginePlugin] The keys registered by an QIconEnginePlugin implementation are now also matched against the current theme (system or user theme), allowing engine providers to implement entire themes through a plugin. Change-Id: I8a5e30ff8b5bb7c78b5204e82760e4328671e4c1 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* PDF: use a map, not a hash, to write the dest roots name treeGiuseppe D'Angelo2024-05-291-8/+8
| | | | | | | | | | | A PDF name tree is sorted, so just use a sorted data structure for that. This simplifies the code. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Ib08b14aaf79c9180319efe7fefa9e797a4364d54 Reviewed-by: Albert Astals Cid <aacid@kde.org>
* PDF: code tidiesGiuseppe D'Angelo2024-05-291-1/+1
| | | | | | | | | | | Take by QByteArrayView instead of const QByteArray &. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I2a5b96ba81fc16487e25be3e957c50ea1b11be76 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
* PDF: write a TrimBoxGiuseppe D'Angelo2024-05-291-4/+11
| | | | | | | | | | | | This is necessary for PDF/X-4 conformance (§ 6.12), but does not hurt specify it always, matching the MediaBox. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Ifc698f271eb1217da15413e4bf25321dea2e955f Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* QPdf: do not write a /Filter key if we are not compressingGiuseppe D'Angelo2024-05-291-1/+2
| | | | | | | | | | | | Streams may or may not be compressed depending on zlib availability, so fix this dictionary. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I852569f053a1338d4bc54be5e8fb1e9c7741a5a1 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* PDF: fix the encoding for the file name of attachmentsGiuseppe D'Angelo2024-05-281-1/+2
| | | | | | | | | | | | | | | A file specification in PDF is a string (§3.10.1 of the PDF 1.6 spec). As such, it needs to be properly encoded. Right now the code was doing a naive conversion to latin1 (which was lossy), and was not considering things like round parenthesis which need to be properly escaped. Just use printString instead. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Icdcf8b553955d31fe2bc430dea54bb6e68221fc7 Pick-to: 6.7 6.5 Reviewed-by: Albert Astals Cid <aacid@kde.org>
* QPdf: cleanup date formatting in the XMP metadataGiuseppe D'Angelo2024-05-281-20/+7
| | | | | | | | | | | | | | | | | Instead of manual formatting, use ISO 8601, which is what XMP wants. Specifically, XMP part 1 delegates datetime formatting to Date and Time Formats, W3C submission, September 1997 http://www.w3.org/TR/NOTE-datetime with a note that the time zone designator need not be present in XMP. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I0468ca21e1cfde47fabdd764af215a2af2efadae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QIcon/QIconLoader: misc cleanupChristian Ehrlicher2024-05-283-68/+65
| | | | | | | | | | | | | Cleanup QIcon: - factor out actualSize() calculation - factor out deleting invalid pixmap entry - don't overflow on int*int calculation - use quint8 for state and mode in cacheKey calculation - sync cacheKey calculation - make QIconPrivate::pixmapDevicePixelRatio() static Change-Id: I7716b6f69687b6e5c910a0cb180b32b2de9a015d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: remove all \since 4.x comments in gui/imageChristian Ehrlicher2024-05-288-69/+0
| | | | | | | | | Remove all \since 4.x comments in gui/image - this is no longer of interest. Change-Id: Ic2d7252293f1951fb202ea907999301581671081 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
* PDF: emit the Trapped entry in the document info dictionaryGiuseppe D'Angelo2024-05-281-0/+1
| | | | | | | | | | | | | Since we don't have any API to specify trapping info, mark the document as untrapped. (PDF/X-4 requires the entry, and requires it to be true or false. The default would be "unknown" but that's not allowed by X-4.) This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: Id8c3a4356ba5bb74877473549e55ccbb6839b07e Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Fix alpha scaling in format changing qcolortransformAllan Sandfeld Jensen2024-05-281-4/+16
| | | | | | Fixes: QTBUG-125306 Change-Id: I5da11df7a27d1947772f5b90a717df1e258fde45 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QImage: allow for scaling CMYK imagesGiuseppe D'Angelo2024-05-282-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The codepaths for image scaling are a bit convoluted, so some "surgery" is needed. QImage::scaled() delegates to transformed(), building a suitable scaling matrix. transformed() checks if the matrix is a scaling matrix, and then has several dispatches. If smooth scaling was requested: * if the image format is supported by smoothScaled() without needing a conversion, delegate to that; * otherwise, if the transform is "non paintable" or the source image is big enough, then again call smoothScale. "non paintable" here means that we're scaling more than 2x down, and QPainter wouldn't do a good job. Otherwise, images in color formats (>= RGB32) are converted by applying the needed transformation on a QPainter and draw the source image with that transformation. Otherwise, if the matrix is invertible (a scaling matrix with non-zero scaling always is, it's a diagonal matrix), then dispatch to qt_xForm_helper. -- Amend this reasoning to support CMYK images: * Make smoothScaled support CMYK without conversions. To do so, make qSmoothScaleImage scale CMYK as if it was a ARGB image. * Make transformed() call smoothScaled() for CMYK images * In transformed(), consider CMYK as nonpaintable, because we can't paint over a CMYK image. * In the non-smooth codepath, also check that we don't try to paint over CMYK, and always go through qt_xForm_helper instead. Note that we still don't support any other transformation for CMYK. Add a test, adapting the exiting one for RGB. Change-Id: Ic72d78923a17fb3963aa22c57265904c716792b0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QCmyk32: make it equality comparableGiuseppe D'Angelo2024-05-281-0/+6
| | | | | | | ... because it is. It's also convenient for tests. Change-Id: I1b9e21763f62c446890ddd5970df25fcae9484b7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* visionOS: Handle Spatial EventsAndy Nichols2024-05-271-0/+1
| | | | | | | | | | | | This patch enables the handling of spatialEvents from SwiftUI. Since these events do not have ObjectiveC structs, for now we serialize them to JSON and pass them to Qt for usage later in Spatial applications. These events just cover the built-in gestures like pinch "clicking" etc. Change-Id: I8368683259eb64277083cf345ca3a5ed9af32ecf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* PDF: fix typoGiuseppe D'Angelo2024-05-262-3/+3
| | | | | | | | | This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I9e1c26749579d645699a180dac88a00e8653ed65 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* PDF: add a comment to what otherwise looks like an unused methodGiuseppe D'Angelo2024-05-241-0/+1
| | | | | | | | | | | I'm not 100% sure we still support WebKit, still leave a note. This work has been kindly sponsored by the QGIS project (https://qgis.org/). Change-Id: I45d4351fd4a106763f26685a5510ed630d752745 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QRegion: re-add rects() and port setRects() to QSpanMarc Mutz2024-05-242-8/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, we had QVector<QRect> QRegion::rects(), but it was deprecated, because just iterating over the QRegion as a container of QRects was more efficient (QRegion has a SSO for the case of one rectangle). With QSpan, we can now bring it back with the same efficiency as iteration, supporting Qt 5 code that never made the move away from rects() and new code that wishes to make the conversion into rectangles more explicit. Re-add the Qt 5 tests, which show that the function is nearly a drop-in replacement for the Qt 5 rects() (QSpan, at the time of this commit, doesn't have relational operators, yet). Also add a QSpan overload of setRects(). The old (ptr, n) function (now obsoleted, but not deprecated) allowed nullptr + n != 0, which QSpan doesn't accept, so print a warning in that case. Also, QSpan can hold more than INT_MAX elements on 64-bit platforms, but QRegion's API was never ported from int to qsizetype, so we need to catch oversized spans used as inputs, too. [ChangeLog][QtGui][QRegion] Added QSpan overload of setRects(); re-added Qt5's rects(), but returning QSpan instead of QVector now. Fixes: QTBUG-124712 Change-Id: I24570c886cbf77abd8d1f4a3f42ae53c892cd9ff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>