summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* rhi: vk: Fix invalid index for unused attachmentsLaszlo Agocs3 days1-12/+14
| | | | | | Pick-to: 6.2 Change-Id: I8140de4eeb1a8a490fcffd10370c29a49d677fed Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove redundant semi-colonsAllan Sandfeld Jensen5 days1-1/+1
| | | | | | | | Causes warnings with clang-cl Change-Id: I57395819debe07aecd045c5a8c747632e6c04fc1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cater for upstream changes in eglplatform.hLaszlo Agocs5 days2-1/+6
| | | | | | | | | | | | | EGL_NO_X11 has been replaced with USE_X11, thus breaking all existing code out there, including Qt: https://github.com/KhronosGroup/EGL-Registry/pull/130 Fix this by defining USE_X11 whenever we do not define EGL_NO_X11. Fixes: QTBUG-96392 Pick-to: 6.2 Change-Id: If8b68caa8c9022477d87169ca2e2a0121a9313e0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Doc: Repair broken link to the XDND protocolLuca Di Sera6 days1-1/+1
| | | | | | | | | | | | | | The documentation for QTGUI's `Drag and Drop` links to the XDND protocol, which is used to manage Drag and Drop on X11. The previous link seems to have been broken for a few years and was thus replaced with a link to XDND on Jhon Lindal's site, who is the author of the protocol. Task-number: QTBUG-96127 Pick-to: 6.2 6.2.0 Change-Id: Ia46b10c7461129491934eb74355f107f96e04383 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* rhi: Remove Q_RELOCATABLE_TYPE for types with QVLA in themLaszlo Agocs7 days2-10/+1
| | | | | | | | | | | | | QVLA itself is non-relocatable due to self references. (ptr pointing to array[Prealloc] as long as capacity < Prealloc) Seems we shot ourselves in the foot in multiple places with this. Pick-to: 6.2 6.2.0 Fixes: QTBUG-96619 Change-Id: I57a2ce539b671326cd352dbe57a1f3d4c46a6456 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce QDoubleValidator::setRange overload with two parametersIvan Solovev7 days2-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QDoubleValidator::setRange() used to have 3 parameters, with the third one (the number of decimals) having a default value of 0. Such default value does not make much sense for a *double* validator. Also, since a default value was used, omitting the decimals was silently overwriting the previous decimals value, discarding the value that could be previously explicitly specified by user. [ChangeLog][QtCore][QDoubleValidator][Important Behavior Changes] The QDoubleValidator::setRange() method now has two overloads. The first overload takes 3 parameters, but does not support a default value for decimals. The second overload takes only two parameters, not changing the number of decimals at all. Hence, the number of decimals will only be changed if the user explicitly specifies it. To maintain the old behavior of setRange(), pass 0 as the 3rd argument explicitly. Note that it is a source-incompatible change. But it should be fine, because using QDoubleValidator with 0 digits after decimal point does not make much sense and so, hopefully, is not that common. At the same time, change the default-constructed QDoubleValidator to use -1 for decimals, which allows arbitrarily many digits in the fractional part. The value was previously 1000, which allowed more than anyone would reasonably use, so this should make no practical difference. Some more unit tests to cover the behavior of the setRange() overloads are also added. As a dirve-by: remove unnecessary QValidator::State to int conversions in the unit tests. QCOMPARE is capable of comparing these enums and provides a better output in case of failure for enums. Task-number: QTBUG-90719 Change-Id: I523d6086231912e4c07555a89cacd45854136978 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* High resolution wheel-event support from libinputAllan Sandfeld Jensen8 days1-0/+22
| | | | | | | | | | | | Is necessary because the support was added using a new event and a new getter. [ChangeLog][QtGui][libinput] Can now use the hires scrolling API from libinput 1.19, adding this feature to QPAs using libinput directly Task-number: QTBUG-96227 Change-Id: Ie30281de2f6391389e9e6049bc4117d3a8f63ad1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QIconLoader: code tidiesGiuseppe D'Angelo9 days2-43/+32
| | | | | | | | | | | | | | | | | | Turn QThemeIconEntries into an owning container (std::vector of unique_ptr), so that code using QThemeIconInfo doesn't have to manage ownership (and forget to do so, and cause bugs like QTBUG-93050). The fallout is mostly on isEmpty() vs empty(); as drive-by fixes: * use auto; * use make_unique (no raw news); * turn a few indexed loops into range-based ones; * streamline an if-else-if chain; * turn a !(a == b) condition into a != b. Change-Id: Ie3ac9de57c80ed3184ec0d15c847f81306ef48ca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix QTextEdit cursor rectangle vertical positioningZhang Hao9 days1-2/+5
| | | | | | | | | | | | | | | When there are characters with different pointsize in QScriptLine, the value of si.descent is less than sl.descent, which will cause the y value of the cursor rectangle to be too large. If si.descent is less than sl.descent, the height of the cursor rectangle is equal to base plus si.descent. Amends e99a883bd382ca950192bd66cafb2a1de6394ce7 Fixes: QTBUG-96288 Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Pick-to: 6.1 6.2 Change-Id: I4a8566b32cfa75d8ca1a584f5e8e577c5c9caf0d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix name used for qmath.h in an includeEdward Welbourne9 days1-2/+2
| | | | | | Pick-to: 6.2 Change-Id: I9be8d4cc33d75a806a1ecf9950d7bac330abe9ea Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove conditioning on Android embeddedEdward Welbourne9 days3-7/+7
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* rhi: vulkan: Reset state more aggressivelyLaszlo Agocs9 days1-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | ...when starting a render/compute pass. This matches most other backends in fact, the Vulkan backend has just certain historical differences, and is complicated due to the fact that it has the option of using secondary command buffers for passes that specify ExternalContents (to support the case of wanting to issue direct Vulkan commands in a code block surrounded by calls to beginExternal and endExternal). Not resetting state such as the currently bound index buffer when starting a pass quickly blows up when two consecutive render passes use different settings, one targeting the primary while the other the secondary command buffer. Instead of further complicating the logic, just reset the relevant state in every begin(Compute)Pass. Comes with an autotest that is crafted so that it manages to downright crash when run with Vulkan without the fix to the backend. Fixes: QTBUG-89765 Pick-to: 6.2 Change-Id: I8dc47bd179c17d45a0556ec31200dc90c4b67ca5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Deduplicate maybeQuitOnLastWindowClosed handlingTor Arne Vestbø9 days4-42/+44
| | | | | | | | | | | | | | | | | | The functionality now lives in QGuiApplication, and is triggered by QGuiApplication and QApplication after dispatching the close event to the window. The slight difference between how a Qt GUI and Qt Widget app determines if a window should contribute to the close-on-quit behavior has been abstracted into a QWindowPrivate helper. The additional checks that were in place for skipping out of the whole maybeQuitOnLastWindowClosed machinery have been kept. Task-number: QTBUG-53286 Change-Id: I81bd474755f9adb3a2b082621e5ecaa1c4726808 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QGuiApplication command line options documentation for X11Tor Arne Vestbø9 days1-3/+3
| | | | | | | Fixes: QTBUG-96600 Pick-to: 6.2 5.15 Change-Id: Ic3670b952d97270cce4f0a8df8bba79e934e4a6d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QPlatformTheme::Appearance for detecting light/dark modesMitch Curtis10 days2-0/+13
| | | | | | | | | And implement it on Windows and macOS. Fixes: QTBUG-83908 Fixes: QTBUG-94859 Change-Id: I7b0c062adf5d4dbaefa64c862ab8ab1348809d71 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Introduce QDoubleValidator::fixup()Ivan Solovev10 days3-2/+108
| | | | | | | | | | | | | The provided implementation tries to fix positions for the group separator. In case of scientific notation it can also converts the value to normalized form. It uses QLocale::FloatingPointShortest internally to convert the double value back to string, so the number of decimals may change after calling this method. Change-Id: I963bc5f97b653e2bb912f4b95b09a4d1ee201e7f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* rhi: document serializedLayoutDescriptionLaszlo Agocs10 days1-4/+31
| | | | | | | | | | | The docs are internal still but won't hurt to keep them up-to-date. At the same time, enhance the QRhiRenderPassDescriptor serializedFormat() docs as well, with appropriate notes about the intended usage of the "serialized" data. Pick-to: 6.2 Change-Id: I8425fff625903468621e3b09d089b345fada85f4 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Allow testing renderpass compatibility without the objectsLaszlo Agocs10 days12-1/+121
| | | | | | | | | | | | | | | | | | | Follow what has been done for QRhiShaderResourceBindings. Have a way to retrieve an opaque blob (that just happens to be a list of integers) so that a simple == comparison can be used to determine compatibility even when the objects from which the blob was retrieved are no longer alive. The contract is the following: bool a = rp1->isCompatible(rp2); bool b = rp1->serializedFormat() == rp2->serializedFormat(); assert(a == b); Pick-to: 6.2 Change-Id: I45e7d05eeb6dfa2b2de474da0a0644912aaf174a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Note in the docs that texture copies expect a matching formatLaszlo Agocs10 days1-0/+5
| | | | | | Pick-to: 6.2 Change-Id: I0a1fb042ec2a3983ffbd146ff9bdc9af20134fa5 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* QTextDocumentLayout: remove multiple calls to lineHeightTypeWaqar Ahmed10 days1-5/+7
| | | | | | | | | | Get LineHeightType once and reuse the value. There still are 2 calls to lineHeightType from inside the QTextBlockFormat::lineHeight but leaving them cause they need a bigger change. Change-Id: I4016a5e483a0358d43f73d174a74545d4f3be338 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* rhi: gl: Have a way to state GL_TEXTURE_RECTANGLE is wantedLaszlo Agocs10 days3-1/+15
| | | | | | | | | | | | | | Added specifically to support the deprecated CVOpenGLTextureCache on macOS, because Qt Multimedia still needs a way to use that when the applications requests using OpenGL instead of Metal. Follow what we did for GL_TEXTURE_EXTERNAL_OES, and add a flag that simply makes all our glBindTexture calls use the GL_TEXTURE_RECTANGLE[_ARB] target. Pick-to: 6.2 Change-Id: If818b13a9f520cdb8bdc16de84a3ca0e18ad6c33 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make the closeAllPopup helper virtual in QGuiApplicationVolker Hilsheimer11 days1-0/+1
| | | | | | | | | | | | | | QPA plugins might have to close popups for events that are not delivered to QWindow or QWidget instances. For instance, the Cocoa plugin has to explicilty close popups when the user clicks into the window frame. Expose this functionality through a virtual in QGuiApplicationPrivate, and move the QApplication implementation from a static helper into the override. Task-number: QTBUG-96450 Change-Id: I52be5710c8d7515b9ae2e4bbadb069df4b3ed546 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: use \note in QKeyEvent documentationTor Arne Vestbø11 days1-8/+8
| | | | | | Pick-to: 6.2 Change-Id: I0924f5a540ab5e58f7830c1af099ce6e44287811 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use QHighDpi::toNativeWindowGeometry()Morten Sørvig11 days1-7/+1
| | | | | | | | | This function implements the isTopLevel() logic, which we now don’t have to duplicate at each call site. Change-Id: Ic8b857aa7cd3c3c23d5e950d9f50b66c81ba3ccf Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPlatformWindow: fix isAncestorOf not breaking recursionRichard Moe Gustavsen13 days1-1/+1
| | | | | | | | | | | | The current implementation got stuck always asking for the parent of the same child This patch will make sure we actually walk up the parent chain. Pick-to: 6.2 6.2.0 6.1 5.15 Change-Id: I9f67f6305e0143526f53952a563d496e760ac2e7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Expose the config and display for EGL-based QOpenGLContextsLaszlo Agocs13 days3-0/+17
| | | | | | | | | | | | | | | | ...in the native interface. Using OpenXR is impossible on some platforms (for example, Android) without knowing all three. The EGLContext alone is not enough, and EGL offers no way to query the EGLConfig a context was created with. https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_opengl_es_enable Therefore, expose all three so libs/apps can use the new way to query these native resource without resorting to the old-style nativeResourceFor* queries. Change-Id: I7efb0a26b858150da55e711752af99426e744322 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Improve QAppleKeyMapper loggingTor Arne Vestbø14 days1-1/+14
| | | | | | Pick-to: 6.2 Change-Id: If0018f2a1c8809e66b695949e8dc7b463c4612a6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix querying font aliases that share name with other fontsEskil Abrahamsen Blomfeldt2021-09-111-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a332f3fabc29f796526202648eddf35a24f1cb67 disabled resolving all fonts on the system for every font lookup, which was a significant startup time improvement. But it also caused a regression: When a font has an alias which shares the name of a proper font, then this would not be resolved correctly. This is fairly typical on Windows/GDI due to backwards-compatibility. Instead of being collected under a shared typographical family, fonts are disambiguated by adding the style name to the family name. The proper typographical name is still available, but this is not enumerated by the system. So "Segoe UI" for instance, will be available as "Segoe UI", "Segoe UI Light", "Segoe UI Bold" etc. When we populate family aliases, we register that "Segoe UI Light" is actually "Segoe UI" with Light weight, and prior to a332f3fabc29f796526202648eddf35a24f1cb67 this would be done implicitly. But after the optimization, we would only populate family aliases once we stumbled over a font request for a non-existent font. For "Segoe UI", we would simply return the regular weight font as the best imperfect match. The fix is to populate font family aliases not only when the family is non-existent, but when the match is imperfect, e.g. if we are asking for a Light weight font and only finding a regular one. User code can still avoid this somewhat expensive operation by using the full family names on Windows. This also requires a fix to a test. When removeApplicationFont() is called, we invalidate the font database, so it will be reset to a state that does not contain the family aliases. Therefore we cannot guarantee that it is identical to what it was before the test started, since this depends on what has happened previously in the application. [ChangeLog][QtGui][Text] Fixed an issue where some font styles and weights would not be selectable. This was especially noticeable on Windows. Pick-to: 5.15 6.1 6.2 Fixes: QTBUG-94835 Change-Id: I892855edd1c8e3d3734aace396f6000d897d2ec4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Move QWINDOWSIZE_MAX to platform headersPaul Olav Tvete2021-09-102-2/+1
| | | | | | | | | | | QWINDOWSIZE_MAX is needed to implement platform plugins and Wayland shell integrations. Moving the #define from qwindow_p.h to qplatformwindow.h makes it available from a supported header file. This should not break anything, since qwindow_p.h includes qplatformwindow.h Change-Id: Ie003b1e9d6494695057d59aba5a17ad7fd51c654 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use qmath.h's conversions between degrees and radiansEdward Welbourne2021-09-101-3/+2
| | | | | | | | The make the semantics overt and avoid the joys of yet another approximation to pi/180 hard-coded in our source-code. Change-Id: I9dcbaada2e7de119e385fc7056bc601ecd59311a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Always give Qt::SubWindows a default window state of Qt::WindowNoStateTor Arne Vestbø2021-09-101-0/+3
| | | | | | | | | | On platforms such as iOS, the default window state is Qt::WindowMaximized, so that calling show() will fill the entire screen. But sub-windows should not get this treatment, as their geometry is typically managed manually. Pick-to: 6.2 6.2.0 Change-Id: Ib17c2011a16baf6023fe368b94fa7f38e12bd777 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Android: Enable QDesktopServiceLars Schmertmann2021-09-102-12/+65
| | | | | | | | | | | | QDesktopServices::openUrl(const QUrl &url) is already implemented on Android. But even if it is possible to set an URL handler, the mechanism to invoke it is missing. With this commit the URL handler will work on Android like it is already working on iOS. Task-number: QTBUG-84382 Pick-to: 6.2 Change-Id: Ic560bd380f1cc59586861aa1a6a3ea064276a39e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Revert "Add Deepin to the list of GTK based desktop environments"Tang Haixiang2021-09-091-2/+1
| | | | | | | | | | | | | | | | | This reverts commit 39f0633f0b00444443e43599aab219a56f6cae2d. The Deepin desktop environment is developed based on Qt, but some applications use dialog boxes of GTK, and some applications use dialog boxes of Qt. This doesn't look good. The initial commit was trying to unify this by always using GTK dialogs. But this turned out to not look good, so instead the plan is that all application dialogs can be based on Qt. Reverting the original commit as a result, as it is no longer applicable. Pick-to: 6.2 Change-Id: I2824b7b2f292f3896c9f94ccce6979f77d66578b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use wayland platform plugin on GNOME wayland sessions by defaultJan Grulich2021-09-091-15/+1
| | | | | | | | | | | Qt wayland platform plugin has improved quite a lot and it is now pretty much usable on Gnome. It also improves user experience a lot on HiDPI displays. Pick-to: 6.2 Change-Id: I943e0bb969f384bdc3c603e290ce9c8358b70f63 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Deepin to the list of GTK based desktop environmentsTang Haixiang2021-09-091-1/+2
| | | | | | | | | Deepin prefers the GTK3 theme implementation with native dialogs etc. Pick-to: 6.2 6.2.0 Change-Id: I54cea9d17c0d7f5e466c700adce5aa68f0cf5564 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Clear up QWindow::isActive() documentationTor Arne Vestbø2021-09-081-1/+3
| | | | | | | | | | The isActive function does not determine if a window should be active, but whether it is currently active. The way the documentation was phrased may have lead people to believe the former. Pick-to: 6.2 6.2.0 5.15 Change-Id: I05a4cb3d8784a2fefa24bdd42ea96cfdae22b9d1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QTextImageFormat: add Qt7 TODO to remove the default valueDavid Faure2021-09-081-0/+1
| | | | | Change-Id: I8b60b302c9df7ce7c44b89fe45f813c4532b7bd6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QTextOdfWriter: fix exporting pixmaps to ODTDavid Faure2021-09-081-2/+2
| | | | | | | | | | | | | | | The QVariant returned by resource() can contain either a QPixmap or a QImage. The code here is now more similar to the one in qtextimagehandler.cpp. Also, the quality is 0 when not set, in which case we want a nice PNG rather than a very very low quality JPG with just a few large blocks of same-color pixels. Pick-to: 5.15 6.2 Change-Id: I49db542e2234c8068f85a636a81a7d8cdb7b5876 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Reset resource state tracking tables upon layout-compatible updatesLaszlo Agocs2021-09-073-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...just like create() would do when requesting a full rebuild. Not relevant for the OpenGL backend, while D3D and Metal may get away without doing this, but the Vulkan backend gives visible rendering errors in Qt Quick once updateResources() is taken into use and a scene manages to do the "right" amount and types of changes. The most common source is a changing uniform buffer offset. Consider how the Qt Quick scenegraph merges uniform data into a single buffer in unmerged batches (i.e. when a set of geometry nodes cannot be batched together in a single draw all). While each node gets its own draw call, each associated srb refers to the same uniform buffer at binding point 0, just with a different offset. Without the layout-compatible-update optimization (that is QRhiShaderResourceBindings::updateResources()) this is not something that needs extra care: once an srb is built or rebuilt (by calling create()), the offset, just like the resource itself is fixed and cannot change. And once create() is called, it conveniently invalidates all related data structures, leading to the subsequent setShaderResources() rewrite descriptors (incl. the resource, the offset, etc.) with Vulkan or do whatever is relevant with other backends. updateResources() only does the minimum amount of changes because we know that the binding list layout has not changed. It turns out this was a bit too minimal, because certain state tracking data structures still need resetting, just as if we called create(). The problem is becoming apparent with non-layout data such as the uniform buffer offset, storage buffer offset, or the storage image mip level. It however works as expected when changing the resource itself. E.g. if a binding point now references a QRhiBuffer different than before, then there is no visible problems, regardless of the buffer offset being different or the same. Hence being difficult to discover, until the aforementioned Qt Quick renderer case triggers it. Why is this? Changing the resource (buffer, texture, sampler) itself works due to the guarantees given by the QRhi resource model. Consider the following: ubuf is a uniform buffer ubuf->create(); srb->setBindings({ references ubuf }); srb->create(); // use the srb in some draw calls // ... // later, when preparing the next frame we decide we need new data with // a different size even: ubuf->setSize(new_size) ubuf->create(); // fill in new data to ubuf // use the srb in some draw calls at this point "magic" happens: note how there is no rebuilding of the srb itself (no create(), no nothing), yet it will correctly pick up the now-different native buffer objects underneath ubuf. This works because there is a certain degree of state tracking happening that allows recognizing that a resource referenced from an srb got rebuilt and now has different native objects (e.g. a VkBuffer) underneath, which in turn needs (with Vulkan) rewriting the associated descriptor with the new native resource. Incidentally, this also makes updateResources() work just fine as long as it replaces the QRhiBuffer/Texture/Sampler reference for the binding point. However, with the example snippet above there is no way to change the other associated data such as the buffer offset. (that would need rebuilding the srb with create(), and that resets all related state tracking structures) So once we encounter an updateResources() where the same QRhiBuffer is now used with an offset different from before, that is not recognized by setShaderResources() and (with Vulkan) it will not rewrite the descriptor with the new offset. (unless the changes for another resource in the binding list trigger it; the granularity here is quite coarse, i.e. we either rewrite (with Vulkan) all descriptors or none at all; this makes the problem even less apparent because now rendering errors occur only when Qt Quick ends with an update where only the uniform buffer offset, but nothing else changed) Pick-to: 6.2 Change-Id: I82ee43aa358947288135ff72ec213e091342e9cb Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Improve srb layout serialization helpersLaszlo Agocs2021-09-072-3/+4
| | | | | | | | | | | Be idiomatic and return the output iterator one past the last element. Otherwise passing in a plain pointer (as exercised by the autotest now) fails to function because we write over the same 4 elements again and again for each binding. Pick-to: 6.2 Change-Id: If74463fa5140ffa2b1d5be97b71868848ad46614 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Enable serializing a layout description without baking an srbLaszlo Agocs2021-09-072-10/+31
| | | | | | Pick-to: 6.2 Change-Id: I66d28cc9d5417bcd5d192fa100c21f69fd42fd6b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Make the serialized srb layout description accessibleLaszlo Agocs2021-09-072-1/+14
| | | | | | | | | | | | | | | | | | | | | ...by the Qt Quick renderer, for example. A typical Qt Quick material binding set serializes to 8 uints. This would not demand a container like QVector. However, being implicitly shared is essential here due to the intended usage (query the serialized blob, put it into a cache key, hash it, compare it, all without any copying and new allocs; we can afford an extra alloc upon each srb construction, but don't want more afterwards in the rendering engines) Also make it clear in the pipeline docs that the optimization Qt Quick is (soon going to be) doing is legal. (the srb ref in the pipeline can be dead and dangling as long as every call to setShaderResources() specifies a layout-compatible alternative) Pick-to: 6.2 Change-Id: I97efbea1fa3516b10c9832adbab0a21b7bc0845d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QPaintEngineEx: solve compile errorZhang Hao2021-09-071-1/+1
| | | | | | | | | Use the same variable name in function Amends 6869d2463a2e0d71bd04dbc82f5d6ef4933dc510 Pick-to: 6.1 6.2 Change-Id: If710a53993e84d048f9052f4fcf92eb57635f585 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* qt_pixmap_thread_test(): Simplify logic, merge warningsSze Howe Koh2021-09-061-12/+6
| | | | | | Pick-to: 6.2 Change-Id: I0c413c14d124bafbd6b2bd94d7a128e19ed83ade Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix segfault when closing widget and destroying window in QDialog::doneVolker Hilsheimer2021-09-061-3/+7
| | | | | | | | | | | | On OpenSUSE we seem to get an Enter event after or while the QWindow is closed, and that appears to reset the currentMouseWindow after we cleared it in QWindowPrivate::destroy. Apply a workaround similar to the focus_window to make sure that currentMouseWindow and currentMousePressWindow don't point to destroyed objects. Pick-to: 6.2 Change-Id: I61afdaa7d8d1d437058624012319460be2f2567f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: Add the PixelScroll device capability (new in 6.2)Shawn Rutledge2021-09-041-0/+5
| | | | | | | | | | Followup to 69c833dae91d004b48f815e0156d6caeb4cdb491 Pick-to: 6.2 Task-number: QTBUG-72167 Task-number: QTBUG-87646 Change-Id: I4ac7cbacd6dc1407ad3b565674a6d6494ec8857f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPixmap: Fix crash if created without gui app in secondary threadSze Howe Koh2021-09-041-1/+1
| | | | | | | | | | | | | The thread checking in in_pixmap_thread_test() is only safe, and only makes sense, if we have a QGuiApplication. If we only have QCoreApplication, only null QPixmaps may be created anyway, so threading makes no difference. Fixes: QTBUG-95358 Pick-to: 6.2 Change-Id: I93c983a3d6c271b0a19dfd0384862fc151459029 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* Doc: add more notes about full screen windows on macOSVolker Hilsheimer2021-09-031-0/+3
| | | | | | | Fixes: QTBUG-68069 Pick-to: 6.2 5.15 Change-Id: I8fc99f708cfa19a9c8cc8d13f6889549c79dd3b3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: add note that hiding a window doesn't close a full screen spaceVolker Hilsheimer2021-09-031-0/+7
| | | | | | | Fixes: QTBUG-52450 Pick-to: 6.2 5.15 Change-Id: I3f819bac470b5a883a74fb58f6fa2d27740eaaf2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* rhi: Add a way to tell an srb that only the resources have changedLaszlo Agocs2021-09-0311-0/+70
| | | | | | | | | | | | | | | | | Until now, after updating the bindings one had to always rebuild the srb, which can be heavy esp. on Vulkan (release old objects, create new layout object, descriptor sets). When updating the binding list in a way that it is fully isLayoutCompatible() == true with the previous list, this is an overkill. Internally, most notably in setShaderResources(), we already should have everything in place in all backends to recognize if the entries in the binding list refer to QRhiBuffer/Texture/Sampler objects that are different than before, and so apart from adding an alternative to create() in the API there is not much else needed here. Pick-to: 6.2 Change-Id: I2efdd4fd0b24c7ebba694a975ed83509744b044b Reviewed-by: Andy Nichols <andy.nichols@qt.io>