summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* Rename “pixelDensity” variablesMorten Johan Sørvig2020-10-232-16/+16
| | | | | | | | | | | | | QHighDpiScaling now computes scale factors based on QPlatformScreen::logicalDpi(), instead of by calling QPlatformScreen::pixelDensity() as done earlier. We forgot the rename the internal state variables, update them to indicate that platform screen DPI is used. Change-Id: Ib718a6176e0ac138395eea13b292f75f69dac3ad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-232-9/+9
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPaintDevice: Remove reserved without reservationsFabian Kosmale2020-10-232-4/+0
| | | | | | | | | | | | It was not during all of Qt 5, and nobody found a use for it when transitioning to Qt 6. It's probably safe to assume that we will not need it during Qt 6's lifetime either. This changes shrinks QPaintDevice to 16 bytes (on 64bit systems), and its child classes like QImage to 24 bytes, meaning that they fit into QVariant's SSO buffer. Change-Id: Ic3b020ad43afe45c76ca0c4056a440345a4e139e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make QEvent::setAccepted() virtual; set QEventPoints state the sameShawn Rutledge2020-10-222-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | In Qt Quick, when we deliver an item-specific QTouchEvent that contains only the subset of eventpoints that are inside the Item's bounds, traditionally the Item can accept the event to tell the delivery logic that the event is handled and doesn't need to be delivered further. But an Item cannot be expected to have total scene awareness; so now, the delivery is "done" only when all eventpoints in the original event are accepted. This behavior has been working well enough already due to logic in QQuickWindow that iterates the points and accepts them if the event is accepted; but it seems appropriate to move this enforcement into QPointerEvent itself. Making setAccepted() virtual gives us a useful degree of freedom. Event-handling code should alternatively use QEventPoint:setAccepted() or QPointerEvent::setExclusiveGrabber() to take resonsibility for only a subset of the touchpoints. Another way to put it is that we treat QPointerEvent::setAccepted() as a convenience method: accepting the QEventPoints is what counts (at least in Qt Quick). Change-Id: Icec42dc980f407bb5116f5c0852c051a4521105a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix to make g++-10.2 happyAndreas Buhr2020-10-221-0/+2
| | | | | | | | | | | | | | g++-10.2 fails to compile qregion.cpp in RelWithDebInfo configuration, with error message: qregion.cpp:3617:12: error: ‘ET.EdgeTable::ymax’ may be used uninitialized in this function [-Werror=maybe-uninitialized] g++ is right here, for Count==1, 'ET' is not initialized but used. This patch fixes this by Q_ASSUMEing Count > 1. Pick-to: 5.15 Change-Id: I3b9f1f58de9f3811c60640a08334487e3f8f2b23 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* name our glib event sources to ease debuggingAndreas Buhr2020-10-221-2/+5
| | | | | | | | | | | glib event sources can have a name, but it is not required. Internal to glib, it is common to give them a name, see for example https://git.io/JTZ8g . This patch gives a name to each glib event source created in qtbase. Task-number: QTBUG-84291 Change-Id: I4f04526dcec082242312e3a66da2adf37a22e626 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* OpenFile portal: use "writable" option to specify our FD is writableJan Grulich2020-10-211-2/+4
| | | | | | | | | | | | | When using OpenFile portal and passing a file descriptor, we open the file with qt_safe_open() which by defaults make the file descriptor writable. However we didn't specify in options that the FD is writable which leads into rejection on xdg-desktop-portal side as there is a mismatch between writable FD and read-only request. Pick-to: 5.15 Change-Id: I7a430339a9615f0a054e777e0f3de56e219d1706 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add forwarding headers for classes moved from QtWidgets to QtGuiVolker Hilsheimer2020-10-201-3/+3
| | | | | | | | | | | | | | | The QT_BEGIN_NAMESPACE QT_END_NAMESPACE block is added to avoid warnings from the build system's sanity check. As a drive-by, fix the include guards in the QtGui/QActionGroup header. Change-Id: Ie10e7830c3b00a3548123f58498def49b194c7aa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crash in tst_QSystemTrayIcon::lastWindowClosed()Allan Sandfeld Jensen2020-10-201-0/+2
| | | | | | | | | Handle null QIcons. Note this was already fixed in 5.15 separately, see 6c8adfaf5dc. Fixes: QTBUG-87729 Change-Id: Ia759fbe95fafcea9451d393dc1aa077f5651919b Reviewed-by: Liang Qi <liang.qi@qt.io>
* Add QSinglePointEvent::exclusivePointGrabber convenience propertyShawn Rutledge2020-10-202-0/+23
| | | | | | | | | | | Since a single-point event (such as a QMouseEvent) only carries one point, it only has one grabber, so we can have a normal Q_PROPERTY. It's named exclusivePointGrabber to avoid shadowing the QPointerEvent::[set]exclusiveGrabber functions that take QEventPoint&. Change-Id: Ie18f1c1849ed057b98f229de7b17b7fc3f3eea36 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix output with box font engineEskil Abrahamsen Blomfeldt2020-10-201-5/+5
| | | | | | | | | | | | | | | | The box font engine was passing in alpha values in the blue channel instead of alpha channel to QImage::setPixel(), probably assuming that setPixel() accepts the input in the format of the QImage. But the whole point of setPixel() is that it converts the input. If we just want to set the alpha value, we can do it directly on the QImage::bits(). [ChangeLog][Text] Fixed showing boxes for glyphs when there are no fonts available in the font database. Pick-to: 5.15 Change-Id: I7ae067c26b9ecba6aaa046e7e4b9ae520c4b3d23 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Update QHighDpiScaling internal documentationMorten Johan Sørvig2020-10-202-57/+105
| | | | | | | | Document new conversion functions and how the new public API (rounding) effects QHighDpiScaling operation. Change-Id: I801fc065cdb4904811a009510b08cac630b83fe7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* high-dpi: Re-implement mapToGlobal and mapFromGlobalMorten Johan Sørvig2020-10-203-48/+22
| | | | | | | | | | | | | | | | | | | | (This code is required to handle corner cases such as a QWindow covering multiple screens, where the normal code path does not give correct results.) Move the map[to|from]Global implementation from qhighdpiscaling.cpp, and implement it in terms of [to|from]NativeGlobalPosition. These functions implement the required screenAt()-type searching. The implementation strategy for both mapping functions is to first map to the native coordinate system, perform the globalPos addition or subtraction, and then map the result back to device independent coordinates. Task-number: QTBUG-81695 Change-Id: I44e9e68651634650964e839b1e564b50f434553f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* high-dpi: Set screen on QWindow::setGeometry()Morten Johan Sørvig2020-10-201-1/+11
| | | | | | | | | | | | | | | Keep (requested) geometry and screen in sync, which is required for correct high-dpi scaling. The platform plugin can still override with new geometry (and screen), as usual. This has previously been fixed/worked around for QDialog, see QTBUG-52735. That fix can now be removed in favor of this change in QWindow. Change-Id: Ieadb1bfee5fb966c5c2052e9daa5ba124a87f3cd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QHighDpi: window geometry scaling functionsMorten Johan Sørvig2020-10-204-16/+26
| | | | | | | | | | | | | | | | | | Add functions which scales window geometry: framNativeWindowGeometry() toNativeWindowGeometry() These correctly handles top-level and child windows, where top-level window positions scale around the screen origin while child window positions scale around (0, 0). Modify call cites to use the new functions. We no longer need the isTopLevel checks at the call site. Change-Id: I0158672d46a3f52dfc7d37d021fc5cebd7859200 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QHighDpi: global geometry scaling functionsMorten Johan Sørvig2020-10-202-15/+31
| | | | | | | | | | | | | Add functions for scaling global coordinates: toNativeGlobalPosition() fromNativeGlobalPosition() These correctly handle the cases where a window spans several screens. Change-Id: I268762499cd8d86a3c417342ddaf2fb6dab4dd20 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QHighDpi: Add screenForPosition()Morten Johan Sørvig2020-10-202-19/+84
| | | | | | | | | | | | | | | | | Implement support for using the screen at a given position when determining the scale factor and origin. Add QHighDpiScaling::screenForPosition(), which searches for a screen at the specified device independent or native coordinates. The function returns the QScreen or nullptr if no screen was found. Add QHighDpiScaling::Point, used for representing an invalid, device independent, or native point. Change-Id: I58e4e3eebb8cdd5171e59f97833a00e7f8d9ecd6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QHighDpi: revert window-on-multiple-screens handlingMorten Johan Sørvig2020-10-201-2/+1
| | | | | | | | | | | | | | Make fromNativePixels() use QWindow:screen() for determining which screen's scale factor to use, even if the point-to-be-scaled is on a different screen. We'll add API for handling the window-on-multiple-screens case in subsequent commits. Task-number: QTBUG-81695 Change-Id: Ib9f40a5a636b2487204c14301ad0190727dcf4ac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QRhiBackendCommandList: avoid new[]/delete mismatchFabian Kosmale2020-10-191-1/+1
| | | | | | Change-Id: Iac2645ebd1d42753817078f194ba61520f5f70c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QFontDatabase: fix a uint->int implicit conversionGiuseppe D'Angelo2020-10-191-2/+2
| | | | | | | Just use an int, as it'll be converted to that anyhow for insertion. Change-Id: Ie5a9d35a7c10e38cbba49d8915602f9207b8e0ac Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPdf: consolidate usage of uintGiuseppe D'Angelo2020-10-194-11/+12
| | | | | | | | | Objects in QPdf are indexed by uint. In a couple of places (incl. QFontSubset) int were used instead, causing sign conversion warnings (turned into errors by -Werror). Use uint instead. Change-Id: Ie0436c8aff3b67d8ef95a5f26fc16403e7e02bd1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QTextTable: fix an implicit uint->int conversionGiuseppe D'Angelo2020-10-191-2/+2
| | | | | | | | Make it explicit; didn't investigate why mixed comparisons are used here. Change-Id: Idd353c76a65ca1c8c4a158886f64c9cbb321494b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove redundant QPointingDevicePrivate::extraShawn Rutledge2020-10-191-1/+0
| | | | | | | The inherited QInputDevicePrivate::extra is enough. Change-Id: I663c63d9b6616ee1f3c312a905a34180a6a038c3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use valid glyph index for box font engineEskil Abrahamsen Blomfeldt2020-10-191-2/+2
| | | | | | | | | | | | | | | | | | Glyph index 0 is reserved for "glyph not found", which can confuse Harfbuzz. For QFontEngineBox we always return a valid glyph since it is the fallback font when no other fonts are available. Symptom of issue was that we could get to Q_UNREACHABLE for certain strings when Harfbuzz returned a glyph count of 0. [ChangeLog][QtGui] Fixed a potential crash when rendering text with an empty font database. Fixes: QTBUG-85016 Pick-to: 5.15 Change-Id: Iaf1d003cdff57320bf4327aa8e63dffd9d1da82c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QColorSpace: port to QESDPGiuseppe D'Angelo2020-10-185-61/+42
| | | | | | | | | | Replace the hand-rolled refcount management with QESDP. Since the class has a default-constructed / moved-from state where the d-pointer can be nullptr, add a in-class detach() that ensures a private object. Change-Id: Id81431fa60132dbc0eed45bb60b38d4f7d73833f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make most of QMetaTypeInterface constexprUlf Hermann2020-10-181-1/+1
| | | | | | | | | | | | | | | | | | The only thing we need to modify at runtime is the typeId and that can be mutable. This way we can have a constexpr ctor for QMetaType which hopefully makes the importing and exporting of related symbols less fickle. On Windows we cannot make QMetaTypeForType constexpr as that leads to mysterious errors in other places. Until we figure out why that is, we just leave this class as non-constexpr. This reveals that qcoreapplication.h and qvariant.h are using QDebug without including it. We now get template instantiation errors. Include qdebug.h to avoid that. Change-Id: If1bf0437ada52459c59c6fa45bab3d22dfb0bc92 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Update and flesh out native interface docsTor Arne Vestbø2020-10-189-448/+437
| | | | | | | | | The namespace and overviews are in the qtdoc repository. Docs for individual interfaces should live with their platform. Change-Id: Iba5fd7e9ebc4f1f634ec9dc3ec125ce88a1312ba Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QMutableEventPoint::detach: deref old privateFabian Kosmale2020-10-181-0/+2
| | | | | | | | | | After detaching, the current QMutableEventPoint obviously doesn't reference old QMutableEventPointPrivate anymore. Deref it, so that we do not leak memory. Change-Id: I3b59667603d41f452eead9a2db13e1d005f622ec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: Make QtGui docs depend on platform integration docsTor Arne Vestbø2020-10-171-1/+2
| | | | | Change-Id: I72cad7f399219d448d78763c50369f087e9d0cf7 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QWindowSystemInterface: Add tablet event overloads without timestampsFriedemann Kleint2020-10-172-0/+34
| | | | | | | | On some platforms, tablet events do not have a time stamp. Task-number: QTBUG-46412 Change-Id: I3cc820b1edaaf55511c000fefb805f5a3a7872a6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix Clang compiler warnings (-Wrange-loop-analysis)David Skoland2020-10-173-8/+8
| | | | | | | | | | | | | | | In a macOS environment, Clang throws a number of compiler warnings about loop variables when building qtbase. See task for more info about the environment. This changes a handful of loop variables, like QJsonValue references into QJsonValueRefs. Task-number: QTBUG-87216 Pick-to: 5.15 Change-Id: I26006efd7c75c2d56ebc7f7efb4c9bdcabe92e8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement move and comparison operators for QEventPointVolker Hilsheimer2020-10-173-4/+76
| | | | | | | | QEventPoints are equal when all data values are equal, the refcount is ignored. Change-Id: I6ef70faf0b12129eaa22bfc1f0a45bab2422d421 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QColorConstants: code tidiesGiuseppe D'Angelo2020-10-171-172/+167
| | | | | Change-Id: Ib4131a583529d2cd6a6d7d27513cca387cb1d722 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix compilation with optimization with g++-10.2Andreas Buhr2020-10-161-0/+3
| | | | | | | | | | | | | | When compiling in RelWithDebInfo configuration with g++-10.2, it complains: qtbase/src/gui/painting/qdatabuffer_p.h:71:36: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] This patch disables this warning in this place. Pick-to: 5.15 Change-Id: Id3154ce80a1921671031828aaa7144214adad5dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Guard vulkan.h inclusion with __has_includeLaszlo Agocs2020-10-161-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | ...and provide our dummy typedefs when vulkan.h is not available. Originally this was there for qdoc, but from the qtdeclarative API review it becomes clear that we need this also when an application - that includes Qt Quick headers which in turn want to use VkImage and co. for type safety - is built on a system without vulkan.h against a Vulkan-enabled Qt build. Also fix some of the typedefs which were technically incorrect. (not that it matters much since the dummy typedefs still do not allow calling exported Qt functions that use the real Vk* types since the function signatures like won't match in some cases (would need to replicate too much hocus pocus from vulkan.h for that), but that's fine since our goal here is to keep application compilation going when it encounters a Vk* type in a Qt header, not about enabling actually calling those functions) Task-number: QTBUG-87450 Change-Id: I855b4478c8707587b28db2408e282145129a0194 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix some bad uses of QSharedPointerData::operator T*Allan Sandfeld Jensen2020-10-161-7/+7
| | | | | | | | Avoid detaching where possible Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* rhi: Further reduce copying in the command bufferLaszlo Agocs2020-10-167-228/+170
| | | | | Change-Id: I2e2ff5f4b8aa91d0accb01108a5199b98c371455 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Unroll the res.binding factory functionsLaszlo Agocs2020-10-161-11/+59
| | | | | | | | | Trading typing in a few lines of straightforward code for a full sizeof(QRhiShaderResourceBinding::Data) copy (with less fortunate compilers that do not manage to optimize it away) is a bad deal. Change-Id: If227320f8a9598508c1fe02c4f56e6d75f0a787b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Port QColorTransform to QESDPGiuseppe D'Angelo2020-10-163-17/+8
| | | | | | | | Remove the hand-rolled refcount management code, and cleanup the existing constructors. Change-Id: I1b91dbf888feff25d67310637d42dcdc3acaac13 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port some more /*implicit*/-like comments to Q_IMPLICITGiuseppe D'Angelo2020-10-163-9/+9
| | | | | Change-Id: Ib70ad3f29365153af647deea54fc45467c413cb9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unwrap private QPalette data memberVolker Hilsheimer2020-10-142-15/+12
| | | | | | | | | Following 556511f9f39ddc887481e0cd5a877134ceb0da6b, there is only one data member in addition to the shared QPalettePrivate, so we don't need a data struct anymore. Change-Id: I8d7f33ed042e47464eb5f60a048956f8bf70e0b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Fix up vertex inputs with matricesLaszlo Agocs2020-10-143-6/+31
| | | | | | | | | | | | In order to prevent too much voodoo in backends like D3D11, the input layout is expected to specify the slice index for vecX that are part of an unrolled matrix. Also deoptimize the instancing manual test to exercise a matrix too instead of just vectors. Change-Id: If2dcbcbc483645ce2420b2f87dda765b95da6e80 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Return false from canFetchMore for uninitialized QFileSystem modelsDoris Verria2020-10-141-0/+2
| | | | | | | Task-number: QTBUG-87273 Pick-to: 5.15 Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add a few missing Q_CLANG_QDOC for native interfacesTor Arne Vestbø2020-10-133-4/+4
| | | | | Change-Id: I5dbe2f7e7c03fb0a130b2da373f6f6a642d57575 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* doc: Add brief and group for native type conversionsTor Arne Vestbø2020-10-132-8/+22
| | | | | Change-Id: I74608619201bf77e487fb986bf213b349cc22f6a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* rhi: Add missing \internal doc commandsTor Arne Vestbø2020-10-121-0/+3
| | | | | | Pick-to: 5.15 Change-Id: I09a69a04c6fcd406602e797cbeec59216fecd5d8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Exclude all modifiers as candidates for shortcutsTor Arne Vestbø2020-10-121-1/+1
| | | | | | | | | If we're going to limit shortcuts to non-modifiers, we should at least include all of the modifiers, otherwise we'll end up passing through e.g. Key_CapsLock. Change-Id: If11758f85d06f75e9b9c2d2a57d4a4915ff72317 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Remove dead codeLars Knoll2020-10-125-25/+0
| | | | | | | This code has been deprecated in Qt 5. Change-Id: Ia8e0bc791ac1f43df7124b4f30db3d0bb9966015 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fallback to using the family when doing an exact matchAndy Shaw2020-10-121-6/+23
| | | | | | | | | | If the difference between the families sizes is just 1 where one of them is 0 in size then we can fallback to the family in that case. Pick-to: 5.15 Fixes: QTBUG-87267 Change-Id: I62b25b06c88000b4d7defe91871c07873b1fc792 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* macOS: Always include non-GL native interfacesTor Arne Vestbø2020-10-121-3/+4
| | | | | Change-Id: Idc8e76b5cb7af8b8df54820a4150ac7d1e3d8944 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>