summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* Rejig native interface plumbingTor Arne Vestbø2021-05-1215-29/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial approach for providing public access to native interfaces via T::nativeInteface<I>() was based on the template not being defined, and then having explicit instantiations of the supported types in a source file, so that the accessors were exported and available to the user. This worked fine for "simple" types such as QOpenGLContext and QOffscreenSurface, but presented a problem in the context of classes with subclasses, such as Q{Core,Gui}Application. To ensure that a native interface for QCoreApplication was accessible both from QCoreApplication and its subclasses, while at the same time preventing a native interface for QGuiApplication to be accessible for QCoreApplication, the nativeInterface() template function had to be declared in each subclass. Which in turn meant specializing each native interface once for each subclass it was available in. This quickly became tedious to manage, and the requirements for exposing a new native interface wasn't very clear with all these template specializations and explicit instantiations spread around. To improve on this situation, while also squashing a few other birds at the same time, we change the approach to use type erasure. The definition of T::nativeInteface<I>() is now inline, passing on the requested interface to a per type (T, not I) helper function, with the interface type flattened to a std::type_info. The type_info requested by the user is then compared to the available types in a single per-type (T) "switch statement", which is a lot easier to follow for someone trying to trace the logic of how a native interface is resolved. We can safely rely on type_info being stable between the user application and the Qt library as a result of exporting the type info for each native interface, by explicitly ensuring they have a key function. This is the same mechanism that ensures we can safely dynamic_cast these interfaces, even across library boundaries. The use of a free standing templated helper function instead of a member function in the type T, is to avoid shadowing issues, and to not pollute the class namespace of T with the helper function. Since we are already changing the plumbing for how a user resolves a native interface for a type T, we take the opportunity to add a few extra safeguards to the machinery. First, we add a static assert in the T::nativeInteface<I>() definition, that ensures that only compatible interfaces, as declared by the interface themselves, are allowed. This ensures a compile time error when an incompatible interface is requested, which improves on the link time errors we had prior to this patch, and also offsets the one downside of type erasure, namely that errors are only caught at runtime. Secondly, each interface meant for public consumption through T::nativeInteface<I>() is declared with a revision, which is checked when requesting the interface. This allows us to bump the revision when we make breaking changes to the interface that would have otherwise been binary incompatible. Since the user will never see this interface due to the revision check, they will not end up calling methods that have been removed or renamed. One advantage of moving to a type-erased approach for the plumbing is that we're not longer exposing the native interface types as part of the T::nativeInteface symbols. This means that if we ever want to rename a native interface, the only exported symbol that the user code relies on is the type info. Renaming is then possible by just exporting the type info for the old interface, but leaving it empty. Since no class in Qt implements the old native interface, the user will just get a nullptr back, similarly to bumping the revision of an interface. Change-Id: Ie50d8fb536aafe2836370caacb22afbcfaf1712a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Tell code-checker drawPolygon can't be called with negative countAllan Sandfeld Jensen2021-05-111-0/+2
| | | | | Change-Id: I082ab823ca039d1d611bfdab6b69e3650d724844 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix QStandardItemModel signals on takeChildLuca Beldi2021-05-111-2/+27
| | | | | | | | | | takeItem and takeChild do not signal the change correctly to the external world, this change fixes the problem Fixes: QTBUG-89145 Pick-to: 6.1 5.15 Change-Id: Ib4844ace53007068a2cd62eba64df99e6e45fdc0 Reviewed-by: David Faure <david.faure@kdab.com>
* Initialize FirstPtBlock.next to make static analysis happyAllan Sandfeld Jensen2021-05-111-0/+1
| | | | | | | | Could in theory be triggered with a 0 line spanning elipsis. Pick-to: 6.1 Change-Id: I2166ee354d2f7488e1fcddfcb8c949c8ca2452fe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid potential read of uninitialized clip dataAllan Sandfeld Jensen2021-05-111-2/+1
| | | | | | | | | Set clip->count to 0 unconditional not just when hasRegionClip or hasRectClip is true. Pick-to: 6.1 Change-Id: Ib3d1c4dc24373df3d4dbc393241226a8730bb9fc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Make resizeMaximizedWindows() preserve native geometryMorten Sørvig2021-05-111-6/+13
| | | | | | | | | | | | | | | | | | Previously, resizeMaximizedWindows() would use the device independent screen size as the source of truth when setting window sizes. However this size may have been rounded, which means that e.g. a fullscreen window may fail to cover the entire screen. Instead, use the native screen size as the true screen size. Set QPlatformWindow geometry, and let the platform update QWindow geometry via geometry change events. Pick-to: 6.1 Fixes: QTBUG-87334 Change-Id: If6e4852dea46ab03c83e469808c0047bc933ee47 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows: Add synthesized fonts also when there is a style nameEskil Abrahamsen Blomfeldt2021-05-113-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Windows can synthesize certain font traits for us, we used to register these in the font database so that we could match against them. But after change 469b13916983aff4625657eecbb7d2399cac901d, this in principle no longer happens, because we opt out whenever there is a style name (which there usually is, this could be e.g. "Regular" for a normal font). The result of this was that if we looked for a bold variant of a font, we would not find it. In cases where a multi-engine was used, the request for bold would still survive in the multi engine's fontDef, so we would still pick it up later and apply the synthesis. But when NoFontMerging was set, then we would override the weight in the fontDef with the one from the font database. Since the comment documents that the additional registrations are there to make sure all the variants that Windows can synthesize are available for matching, it does not make sense to skip them just because the font has a style name. So this is a partial revert of 469b13916983aff4625657eecbb7d2399cac901d. Note: This exposed an error in QFontDatabase::isSmoothlyScalable(). The style parameter here is not the "styleName" (as in sub-family), but actually predates that API. Instead it is the "style" as returned by QFontDatabase::styles(), which may be the style name, but it can also be the generated description of the style and weight. In the latter case, we would return false for fonts that are actually smoothly scalable, which is incorrect. This caused a failure in tst_QFontMetrics::metrics(). To remedy this, we add an additional condition, and also match the style if it matches the generated descripion of the style key. [ChangeLog][Windows] Fixed an issue where bold/italic would not be synthesized for fonts if QFont::NoFontMerging was set. Pick-to: 5.15 6.1 Fixes: QTBUG-91398 Change-Id: Id2166a47ae2d386536cf6e5e27ff09165ae8a23a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* rhi: Fix memory leakRobert Löhning2021-05-101-3/+4
| | | | | | | | | | | | The leak can be reproduced by running the test project from QTBUG-63557 with asan, although that report is about yet another leak. [ChangeLog][gui][QRhiGles2] Fixed a memory leak in QRhiGles2 Task-number: QTBUG-63557 Pick-to: 6.1 Change-Id: Ic4d346abb36a5666feb3ceb881865b029f5a6945 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Move QtX11Extras into QtGui as private APITor Arne Vestbø2021-05-103-0/+663
| | | | | | | | | | | from qt/qtx11extras 0e67fb41cfc4b4bfbaa7dc75f8ddebdf5a08e836. The plan is to expose these as native interfaces, so this is a first step. Task-number: QTBUG-83251 Change-Id: Iecba8db9a4f616a08a3750ddaae08cc30ec66f89 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix antialiasing of rotated non-smooth scaled imagesAllan Sandfeld Jensen2021-05-101-1/+2
| | | | | | | | | The fast-path can't antialias edges, and shouldn't be used when that is requested. Pick-to: 6.1 5.15 Change-Id: I3a0ce120ab96a6f95d11c165d1f5b356dae009fe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Move QNativeInterface helpers to their own header fileTor Arne Vestbø2021-05-1011-0/+16
| | | | | | | | | The machinery is not needed for all translation units, so keep it out of qglobal.h. Change-Id: Ib0459a3f7bc036f56b0810eb750d4641f567f1fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid coverage overflowAllan Sandfeld Jensen2021-05-101-0/+4
| | | | | | | | | | | We end up excluding more than 65536 from 65536 of rowHeight. Perhaps better fixed earlier, but I can't figure this logic out right now. Pick-to: 6.1 5.15 Change-Id: I5721c469441f15ac112180f971c857cd67edbf96 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Avoid fast transform paint path on values it can't handleAllan Sandfeld Jensen2021-05-101-2/+6
| | | | | | | | | | It has a problem with very small targets, and coordinates can't exceed the same bounds we have on dimensions. Pick-to: 6.1 5.15 Fixes: QTBUG-93475 Change-Id: If5b3af324f4e525cee3dc448ba41fdd8a91cc880 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Allow background inheritance between non-body block elementsAllan Sandfeld Jensen2021-05-081-1/+4
| | | | | | | | | | | Most nested block elements are merged together, so while we shouldn't do real inheritance we need to do it when block elements are combined. Pick-to: 6.1 Fixes: QTBUG-91236 Change-Id: I9e37b15f705db92c79a620d0d772f25d0ee72b8d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Support CSS text-decoration-color in underlines, overlines, strikethroughShawn Rutledge2021-05-076-4/+19
| | | | | | | | | | | | Also add a feature to the textedit example to set this value. [ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines and strikethrough. Fixes: QTBUG-82114 Task-number: QTBUG-39617 Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Apply specialData font capitalization to non-rawFont textAllan Sandfeld Jensen2021-05-061-2/+12
| | | | | | | | | | | We were not using the capitalization details from specialData in the regular path of QTextEngine::itemize() causing it to be ignored. Pick-to: 6.1 5.15 Fixes: QTBUG-90840 Change-Id: I7bb71fad4009f6d0685905a946c36ac1d24d8d3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QWindow: synthesize a QContextMenuEvent from relevant mouse eventsVolker Hilsheimer2021-05-062-5/+30
| | | | | | | | | | | | | | | QWindow receives keyboard originated context menu events, so it should also receive events originating from a right-button mouse event. Remove the incorrect statement about the special acceptance flag for context menu events. There is no such thing, the event gets delievered after the corresponding mouse press/release event. Fixes: QTBUG-59988 Task-number: QTBUG-93486 Change-Id: I148310440604e74f600932cc1898fa152c483a61 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove duplicated declaration of QCocoaGLContext native interfaceTor Arne Vestbø2021-05-061-7/+0
| | | | | | | | The interface is already declared in qopenglcontext_platform.h, so the inclusion in qcocoanativeinterface.mm was unintentional. Change-Id: Ic6d4a86527d03787efd858c1a6568933be8a4327 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Fix synthesized boldEskil Abrahamsen Blomfeldt2021-05-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | When a user requested bold and there was no available font for this (which is quite common with CJK fonts and in fact is the case for the official Japanese font on the system), we should synthesize the boldness. This was done by checking if the requested font weight boldness matched the one in the font's traits, and if not, we flag the font boldness to be synthesized. But when initializing the font, we would first override the requested weight with the selected font's weight, *before* performing the check above. So even if there was a mismatch, we would not catch this and as a result, e.g. the system Japanese font would never be bold. [ChangeLog][macOS] Fixed an issue where boldness would not be correctly synthesized for families with no bold variant. Fixes: QTBUG-85634 Pick-to: 5.15 6.1 Change-Id: I36da59d7689455e29cca283cb0724a0841095918 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows: Work-around misreporting of Script and RomanEskil Abrahamsen Blomfeldt2021-05-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | Two legacy bitmap fonts are misreported as TMPF_VECTOR on Windows: Roman and Script. This causes them to be marked as scalable, and the automatic fallback to NativeRendering in Qt Quick does not kick in - causing the text elements to look empty instead. To work around this, we exploit the peculiarity that the type of these two fonts is reported as "0" in the enumeration, which is not a valid value. No other fonts on the system is reported as type 0, so we simply detect this error case and mark the fonts as non-scalable, which is the safer choice. [ChangeLog][Windows] Fixed text in "Roman" and "Script" bitmap fonts not showing in Qt Quick applications. Pick-to: 6.1 5.15 Fixes: QTBUG-85826 Change-Id: Id889f0dedb1d529e6dd64c6da9e17e303f4a9d04 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove Qt6 switches from QtGuiAllan Sandfeld Jensen2021-05-0512-70/+0
| | | | | | | Removing now dead code Change-Id: I021539da6517fdb8443f8ae9431fc172b7910cfc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix rare integer overflow in text shapingPaul Olav Tvete2021-05-051-1/+2
| | | | | | | | | | With extreme painter scaling, linearAdvance may be too large to fit in an unsigned short. Fixes: QTBUG-91758 Pick-to: 6.1 5.15 Change-Id: I7bbe6e77ec9bcef4aa5259da1d3000ed1a8eb27a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Edid parser: fix performance issuesGiuseppe D'Angelo2021-05-052-34/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A) When a QEdidParser gets built, the code populates a QMap by parsing the system's pnp ids file. With > 2000 entries in the file, that's 2000+ allocations for the QMap, plus 4000+ allocations for key/value (QStrings), plus a bunch of temporaries created for processing. What's more, on XCB and EGLFS, a QEdidParser gets built *per screen*; the map is not shared and gets rebuilt for each screen. It's however completely unnecessary to keep this map in memory. The lookup is required only once per monitor change event, which, apart from application startup, is an extremely rare event. When such an event happens, and we have to lookup a vendor id, we can just process the pnp database "on the fly", therefore removing the constant memory usage from the application run. In order to also avoid an allocation spike, just don't build a map at all: simply process the file, using no memory allocations, one line at a time while searching for the vendor id. I was unable to find information about the file format, so I am not sure if it's guaranteed that it's kept sorted by id (this could allow for a faster fail path). B) In case of a cache miss, a hardcoded vendor table is used to try and identify the manufacturer. Look up in the hardcoded table using binary search, rather than a linear scan, and don't allocate memory for each element processed in the list (!). The size of the list (2000+) is big enough to completely justify binary search. C) Drive-by, remove a TOCTOU bug when opening the system file. D) Drive-by, fix the includes in the header to IWYU. Change-Id: I57c7cbd09a145c6efe3023c227ed36b24bed96f9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Write out the HTML correctly for nested listsAndy Shaw2021-05-052-3/+27
| | | | | | | | | | | | | | When we are having nested lists then we need to ensure that the HTML is outputted correctly so that the closing list and item tags are placed in the right order. [ChangeLog][QtGui][QTextDocument] The output of toHtml() now handles nested lists correctly. Fixes: QTBUG-88374 Pick-to: 6.1 5.15 Change-Id: I88afba0f897aeef78d4835a3124097fe6fd4d55e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Export text-decorationAllan Sandfeld Jensen2021-05-051-7/+22
| | | | | | | | | It used to be ignored because we couldn't disable it, but that works fine now. So re-enable it. Fixes: QTBUG-91171 Change-Id: I4cf966211bb200b73326e90fc7e4c4d3d4090511 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* rhi: gl: Sanity check vertex outputs and fragment inputsLaszlo Agocs2021-05-032-0/+26
| | | | | | | | | | | | | | | | | | | | | | Print a warning if the name for a given location does not match. This is relevant only to OpenGL and only to < 330 GLSL versions: there the location qualifier is simply not present in the actual shader code and all matching is name-based. This leads to hard to discover problems in Qt Quick ShaderEffects for instance, where providing a custom fragment shader but using a built-in vertex shader is common, and one may be tempted to use a name other than qt_TexCoord0 for the input variable in the fragment shader. Unfortunately this breaks, sometimes silently, when not having location qualifiers. (and we won't, neither in GLSL 120 or 150 which are the standard for Qt Quick) Make this situation recognizable by printing a warning to the debug output. Pick-to: 6.1 Task-number: QTBUG-92500 Task-number: QTBUG-93370 Change-Id: I0d0bcc135e23a228783f7633f872e39c4e43bb93 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Disable spurious MSVC warning C4273 in Qt Gui, Qt OpenGLKai Köhne2021-05-032-0/+10
| | | | | | | | | | | | For optimized/release builds, cl 19.28 produces some false positive "potential divide by 0" warnings even for code where no valid code path can lead to such a division. Fixes: QTBUG-92940 Pick-to: 6.1 Change-Id: I461f9104d7b9dc2d74839bf30bebb2b9d4cf2db3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Parse QT_SCREEN_SCALE_FACTORS spec only onceMorten Johan Sørvig2021-05-032-36/+66
| | | | | | | | | | Move parsing to initHighDpiScaling() and store the parsed factors in a vector. The factors are later applied in updateHighDpiScaling() where the factor list is compared to the screen list. Change-Id: I59fc67b84932dbe69868a3683686a91e51333104 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add grabber context pointersShawn Rutledge2021-05-012-0/+26
| | | | | | | | | | | | | | | | | | | | | | In Qt Quick we now need to keep track of which QQDeliveryAgent is responsible when a point is grabbed, either passively or exclusively. When we re-deliver to that grabber, we need to do it via the same agent, so that the same scene transform is used, and the grabber will see the event in the correct coordinate system. It's easier to track this mapping here instead of in a separate map in Qt Quick. (This is an alternative to 40330b8f0a717098982d1f54f34a18a8262b1f55: it was not possible to use QFlatMap, because we need to keep the passive grabbers in the same order as they were added. We don't use a QList of structs, because QPointerEvent::passiveGrabbers() needs to return a QList of just the grabbers, and it's not as efficient to construct that list in the accessor.) Change-Id: I457114f816736749d2ea5ee48fa03524eb93d2d0 Pick-to: 6.1 Task-number: QTBUG-92944 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix “unused variable” warningMorten Sørvig2021-04-301-0/+2
| | | | | | Change-Id: I2b151d7a0cda8774c236de1a024acbb3a1875c7e Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Revert "Add grabber context pointers"Shawn Rutledge2021-04-293-16/+11
| | | | | | | | | | | This reverts commit 40330b8f0a717098982d1f54f34a18a8262b1f55. It was a bad idea to use QFlatMap here, because it is a sorted map, but we need to keep the passive grabbers in the same order as the grabs happened. So need to go back to an earlier version of the patch that uses two parallel QLists. Pick-to: 6.1 Change-Id: I9e6013c2565986fe1eb9fd754f8259766f83bee5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Call updateHighDpiScaling() on screenAdded()Morten Johan Sørvig2021-04-283-16/+1
| | | | | | | | | | | | | | | | | | | | | | QHighDpiScaling has two init/update functions: - initHighDpiScaling(): called once during QGuiApplication construction - updateHighDpiScaling(): called whenever (relevant) screen configuration changes Currently the calls to updateHighDpiScaling() are made from multiple places including platform code. Simplify by calling it from two locations: - QWindowSystemInterface::handleScreenAdded() - QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange() Replace comment about early calls to qt_defaultDpi with a test which calls qt_defaultDpiX/Y with no screens attached. (Looking at the qt_defaultDpiX() implementation, it is unlikely that there will be a problem as long as updateHighDpiScaling() is called before QGuiApplication::primaryScreen() starts returning a non-null value.) Change-Id: I447db42894617495843a5cb531a1322b000fed62 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add grabber context pointersShawn Rutledge2021-04-283-11/+16
| | | | | | | | | | | | | | In Qt Quick we now need to keep track of which QQDeliveryAgent is responsible when a point is grabbed, either passively or exclusively. When we re-deliver to that grabber, we need to do it via the same agent, so that the same scene transform is used, and the grabber will see the event in the correct coordinate system. It's easier to track this mapping here instead of in a separate map in Qt Quick. Pick-to: 6.1 Task-number: QTBUG-92944 Change-Id: I69f769c694d0da24885cdf4087e5032022bff629 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Regenerate configure.cmake filesAlexandru Croitor2021-04-271-1/+1
| | | | | | | | | And adjust configure.json files that were stale Amends d385158d5213ef568b7629e2aa4a818016bbffac Change-Id: I851838a12c3773a6e8119ebc7f1de941ae7fe224 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add storage for (pixel) deltas and fingerCount to QNativeGestureEventShawn Rutledge2021-04-276-13/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | It's not clear now whether trackpad gestures on Windows will need to be so different than on macOS; however, any reasonable int value can be stored in a qreal, and in Qt Quick we like to use floating-point numbers for all "real" values and measurements. So since we need to add more storage, and quint64 m_intValue has never been used, we now replace it with a QVector2D, which should have the same size. The intended use is that PanNativeGesture will include a displacement, probably in pixels, by which the viewport or some target item should be panned or moved. The naming of deltas() is flexible enough to support any gesture with some incremental 2D valuators, though, just as value() has gesture-dependent semantics. fingerCount() will be useful for Qt Quick pointer handlers to filter out events that have the wrong number of fingers, e.g. to require that either a 3-finger pan gesture or 3 individual touchpoints are required to activate DragHandler { minimumPointCount: 3 } (assuming we implement pan gesture support in DragHandler). Fixes: QTBUG-92179 Task-number: QTBUG-92098 Change-Id: I5462aea9047beed6e99075294a62011edd8a59f5 Reviewed-by: Povilas Kanapickas <povilas@radix.lt> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Remove GENERATE_METATYPES usageMaximilian Goldstein2021-04-271-1/+0
| | | | | | | We now generate metatypes by default and every instance of GENERATE_METATYPES now causes a warning. Change-Id: I83a124de3f3bb1fc770cfae0eed955c03e95b310 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* doc: Warn about kerning in QRawFont::advancesForGlyphIndexes()Eskil Abrahamsen Blomfeldt2021-04-271-2/+12
| | | | | | | | | | | The fact that KernedAdvances does not work correctly on a majority of fonts is confusing. So we warn users that this is the case and point them to the correct function to use instead. Task-number: QTBUG-92930 Change-Id: I70f4b09ea1050fceabbff25a9c91008d1754f772 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Avoid adding null-objects to the icon cacheFan PengCheng2021-04-231-3/+3
| | | | | | | | | | When we can't get the icon for the first time, we would use the data in the cache later, and we will never get the new icon when the system theme is updated while the application is running. Pick-to: 6.1 Change-Id: I839ad9983918561a1dc6bc842f85477bba53f64a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't own unique name for QDBusTrayIconIlya Fedin2021-04-212-14/+5
| | | | | | | | | | | | | | | | | | Flatpak doesn't allow to own random name with PID. Even after adding such a permission into manifest, all flatpaked apps have PID 2, so only one Qt application at a time can have tray icon. Even though unique name is a part of the spec, no tray hosts really check it and SNI implementations without unique name run just fine inside and outside of Flatpak. This fixes the inability of Qt applications to have tray icon in Flatpak outside of KDE. Pick-to: 6.0 6.1 5.15 Change-Id: Ieea6dc335b7a74537a51929f6e70ca68c84228fb Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't use qreal as a loop counterEirik Aavitsland2021-04-211-5/+7
| | | | | | | Fix static analyzer warning Change-Id: I5c1a0c63e66b7c2511b4801bbe399681de998850 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add Solaris support in cmake buildNiclas Rosenvik2021-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add SOLARIS cmake platform definition. Add settings for QT_DEFAULT_MKSPEC so that qplatformdefs.h can be found. Solaris has its gssapi symbols in libgss. Solaris supports @ORIGIN. Solaris ld does not support --dynamic-list needed for reduce relocations. Make solaris fail the reduce relocation test. getauxval is specific to GNU libc and some other libc implementations on Linux but sys/auxv.h is not. The bootstrap uses sys/aux.h as the only indication for getauxval. This breaks builds on Solaris, so only make sys/auxv.h an indicator for getauxval on linux or glibc based systems. Solaris uses X11 so add it to the X11_SUPPORTED list. Solaris network libraries for sockets etc are in socket and nsl. ifreq does not have a member ifr_ifindex on Solaris, it uses ifr_index. Add test to check if ifr_index is a member of ifreq. The first struct in the in_addr union on solaris is defined as four uint8_t, therefore four arguments are needed for its initializer list. Change-Id: Ieed4c1bbac8559a7ae1db9c4e1e91f609f150270 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QEdidParser: build only on XCB/EGLFSGiuseppe D'Angelo2021-04-211-2/+6
| | | | | | | | | No other platform needs it, so avoid building and shipping unused code. Change-Id: I23b68b58eb0523459014df915ad8516c22adbcc1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Edid vendor table generator (3/N): regenerate the tableGiuseppe D'Angelo2021-04-211-37/+271
| | | | | | | Use an updated output from the script. Change-Id: I85c4706c637bd5ceda6667257e48c16943637f9b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Edid vendor table generator (2/N): use idiomatic C++Giuseppe D'Angelo2021-04-211-2/+2
| | | | | | | | In C++ we can give names to classes, so just use that, without C-isms (typedef struct). Change-Id: I27239d8d5c28864b3f4f7bd4013cc47c045b4b04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid combining enum values from different enum typesEirik Aavitsland2021-04-211-2/+2
| | | | | | | | Fixes static analyzer warnings. Task-number: QTBUG-91911 Change-Id: I55599d53bb98ada74ceb73d5668fcc18813c3ec4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove xcb-native-painting setting from the configure summaryEirik Aavitsland2021-04-201-1/+0
| | | | | | | | No need to spam the summary with this unsupported feature. Pick-to: 6.1 Change-Id: Ie644a7077762d818fd62a22a8b6d3db025f92c81 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Draw the cursor considering the descent is 0Tang Haixiang2021-04-201-3/+3
| | | | | | | | | | | | | | When the descent of the item is 0, ascent is the height of the item, base(base = si.ascent)> sl.base. At this time, sl.descent is not considered. The calculated y value may be <0. Fixes: QTBUG-86823 Fixes: QTBUG-92468 Pick-to: 5.15 6.0 6.1 Change-Id: I9cf088dec9162595e52ff72aa90ec3153a30fb72 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Introduce zlib find script to work around hardcoded iOS SDKAlexandru Croitor2021-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xcode allows building a project targeting either the device or simulator sysroot in one single build dir, but for the sysroot switching to work there should be no linker or compiler flags referencing absolute paths of a specific sysroot. During CMake configuration of a project targeting iOS, all found system libraries will be within one single sysroot, either the device one or the simulator one, whichever one was passed to CMAKE_OSX_SYSROOT. CMake will then generate the Xcode project and pass those absolute paths, which makes sysroot switching within Xcode not work. To avoid that, the CMake documentation recommends passing linker and framework flags of the form '-lfoo' and '-framework bar' instead of absolute paths. Xcode then takes care of setting the correct framework search path. Zlib is one of the libraries found in the iOS sysroot and thus passed as absolute path. To avoid that, create a new FindWrapZLIB find script. The target it creates will pass the absolute path to the library on non Apple platforms and an -lz linker flag on Apple platforms (macOS and iOS). To avoid issues with target global promotion when system PNG package is found, ensure that a found ZLIB::ZLIB target is promoted to global manually in src/gui/configure.cmake. Pick-to: 6.1 Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Assert that engine isn't nullptr before dereferencingVolker Hilsheimer2021-04-191-0/+1
| | | | | | | | | | | The engine pointer is guaranteed to be initialized in line 1838, so we can assert that the correct value is passed into the function to fix static analyzer warning 1d9b8ce922ee0891fb0d477dc17fdb8d. Change-Id: I773bbaa579afec0d7a79d4393ee66fd26ba9629b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Assert that engine isn't nullptr before dereferencingVolker Hilsheimer2021-04-191-6/+8
| | | | | | | | | | | | | | | | | | | | Various checks for "engine" in the previous code suggested that engine might be nullptr by the time we want to populate the out-parameters. This must not be the case, and QFontDatabase::load asserts already that a valid engine is loaded and returned. Fix static analyzer warning 7f68daa282c72e8cc172c681eb02f559 by asserting it here as well. As a drive-by, change the tested out-parameter to the last one in the list of optional parameters. Pick-to: 6.1 Change-Id: I3d9ff0f5f7c4740014301c073480d14fef54e2fb Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>