Commit Graph

54026 Commits

Author SHA1 Message Date
Yuhang Zhao
1e9f9a4b7d QOperatingSystemVersion: cache the retrieved version
It won't change during runtime, so make it a static
variable to avoid fetching the information repeatedly.

Change-Id: I430ceba218f9f3515558736238d1d5a74cf59419
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-11-23 09:59:55 +00:00
Timur Pocheptsov
3fcdb6cb6e QCocoaMenuBar: set the app's 'Window' menu
To enable a list of windows the app has open in the Dock's menu.
Not to surprise existing applications with a 'Window' menu where
they did not have it before, make the item hidden.

Fixes: QTBUG-59433
Change-Id: I1ac3d3de69f4313f39c4631dc4b68bf6e096532a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-23 08:35:22 +00:00
Yuhang Zhao
e01c25e859 QtBase: replace windows.h with qt_windows.h
We have some special handling in qt_windows.h,
use it instead of the original windows.h

Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-23 12:53:46 +08:00
Marc Mutz
4c7759cae2 Restore src/tools/moc/util/generate_keywords.pro
The file was inadvertently removed in
ad2da2d27a.

Pick-to: 6.2
Change-Id: Iaaf74d7ae382b0c9487fb25a58632dfc5be6538d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-23 00:36:34 +00:00
Marc Mutz
0fc2cde89b qapplicationstatic.h: fix syncqt warning
Warning was:
  "QtCore: WARNING: src/corelib/kernel/qapplicationstatic.h includes QMutex when it should include QtCore/QMutex"

Comply.

Change-Id: Ifc74b4f8052b7e95f86cab9a01a7e91bcbc3022d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-23 01:36:34 +01:00
Marc Mutz
9d79e5f26c QVLA: Self-Encapsulate Fields
Use member functions to access some (combinations of) fields in
preparation of moving said fields to base classes:

   s + ptr  → end()
   s        → size()
   ptr      → data() (or begin(), depending on context)
   a        → capacity()

Fixed a const-incorrectness issue detected by the change.

Task-number: QTBUG-84785
Change-Id: I2218d57559208c9d77b8860d419979e92f140e13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-22 21:20:54 +01:00
Eirik Aavitsland
8ce3693856 QImageReader: check allocation limit for minimum 32 bpp
Also, as a driveby, add an environment variable so the limit can be
changed at runtime.

[ChangeLog][QtGui][QImageReader] When checking allocation limit during
image reading, the memory requirements are now calculated for a
minimum of 32 bits per pixel, since Qt will typically convert an image
to that depth when it is used in GUI. This means that the effective
allocation limit is significantly smaller when reading 1 bpp and 8 bpp
images.

Pick-to: 6.2 6.2.2
Change-Id: If1b204d413973b0975eea531e29c260fdcec931d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-22 14:29:20 +01:00
Heikki Halmet
f1c280f31f Add support for Microsoct Visual Studio 2022 official release
MSVC2022_PREVIEW can be removed later when MSVC2022 official
release has been merged

Task-number: QTQAINFRA-4540
Pick-to: 6.2
Change-Id: I7756b53b1cd5863d21c1c1e3bb19373f6f0cf8fa
Reviewed-by: Ville-Pekka Karhu <ville-pekka.karhu@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-11-21 20:22:39 +02:00
Sona Kurazyan
102f7d31c4 Add support for combining multiple QFutures
[ChangeLog][QtCore] Added QtFuture::whenAll() and QtFuture::whenAny()
functions, returning a QFuture that becomes ready when all or any of the
supplied futures complete.

Task-number: QTBUG-86714
Change-Id: I2bb7dbb4cdc4f79a7a4fd494142df6a0f93a2b39
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-20 10:28:29 +01:00
Thiago Macieira
3b49aa72fe Q{CoffPe,Elf,MachO}Parser: check that the magic string is present
Commit 2549a88ba2 changed the ELF and
Mach-O parsers to return an offset to the actual data header, not the
magic string, which we stopped searching for anyway. This commit brings
such a validity check back and adds it to the new COFF PE parser.

Change-Id: Iccb47e5527544b6fbd75fffd16b8b2252a76f179
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 22:51:04 -08:00
Thiago Macieira
892d5607d0 QPluginLoader: add COFF PE file parser
Fixes: QTBUG-67461
Docs: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
Change-Id: I5e52dc5b093c43a3b678fffd16b77bf9a8f2b17e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 22:51:03 -08:00
Thiago Macieira
235173175b CMake: reorganize the QT_FEATURE_library portion of CMakeLists.txt
No need to attempt to compile both qelfparser and qmachoparser in all
systems.

Change-Id: Iccb47e5527544b6fbd75fffd16b7ee5a1555a7a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-19 22:51:02 -08:00
Thiago Macieira
09c58614db QString::fromUtf16: use qustrlen
We have it.

Pick-to: 6.2
Change-Id: Iccb47e5527544b6fbd75fffd16b901fe4d2920a7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 18:33:07 -08:00
Marc Mutz
fd8f81f385 Re-apply "QReadWriteLock: replace (QWaitCondition, QMutex) with std::(condition_variable, mutex)"
This reverts commit 1283ee3245.

We now have wrappers around std::mutex and std::condition_variable
that fall back to QMutex and QWaitCondition on the broken Integrity
toolchain. Use them.

Change-Id: I881aa931167b845b489713048b57ccc5f79d4237
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-11-20 02:38:41 +01:00
Marc Mutz
229f356cef Short live q20::ssize()!
Extract the definition of q20::ssize() from tst_qanystringview.cpp,
where it had to be placed for its backport to 6.2.

Change-Id: I3f758c98a4b1efd453f4fc044b8d3f1a89de62d1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-11-20 01:38:41 +00:00
Marc Mutz
2fbe460245 QAndroidActivityResultReceiver: avoid double(triple)-lookup
The code used the if (!contains()) { insert() } anti-pattern,
necessitated by Qt's deviation from the STL of allowing insert() to
overwrite an existing entry, causing two lookups of the same key.

Fix by recording the size prior to the execution of the indexing
operator and taking a size increase as the cue to populate the (new)
entry. This way, we look up the key only once.

Also fix two instances of double lookup caused by the if (contains())
{ value() } anti-pattern.

Change-Id: I961fe45ec571aa94aff5dd578f2276e7b74d800d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-20 02:38:40 +01:00
Ievgenii Meshcheriakov
07034b765e Use Authz API to query permissions info in Windows filesystem backend
Microsoft documentation for GetEffectiveRightsFromAclW function that
was used previously has this at the top of the page:

> GetEffectiveRightsFromAcl is available for use in the operating
> systems specified in the Requirements section. It may be altered
> or unavailable in subsequent versions. Instead, use the method
> demonstrated in the example below.

This says to me that the function is deprecated. In addition to
that, it is not able to handle ACLs that are not in "canonical"
order, returning ERROR_INVALID_ACL. Such ACLs are useful to
represent POSIX permissions in Windows, and are produced by
Cygwin for example.

This patch uses Authz API referenced by the message quoted above.
The used API is available starting from Windows XP/Windows Server
2003. This API also allowe to perform access checks given access
token, and so allows to use similar code all permission checks.

Task-number: QTBUG-79750
Change-Id: I8b11ff3cc83cd9ed5bfb2ce9432a375a122cdbbf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 23:35:48 +01:00
Tor Arne Vestbø
db780c4ca5 xcb: Return standalone image from QXcbBackingStore::toImage()
Otherwise the original backingstore image will detach from the
m_xcb_image data on the next backingstore paint or scroll.

Pick-to: 6.2
Change-Id: I73f68d9c2e7c106951541831a5df8b97695f2001
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-19 21:55:45 +01:00
Alexander Volkov
185c8d5adf Skip disabled proxy widgets when (back)tabbing
Fixes: QTBUG-98137
Pick-to: 6.2 5.15
Change-Id: If52053dce361b130ef7dcfaf747710d8ceb9bbcd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-19 23:55:44 +03:00
Joerg Bornemann
610123b1c8 Move the 'qmake' feature to src/tools/configure.cmake
This allows us to present 'qmake' in the tool-related section of the
configure summary.

Change-Id: I897dec23cb0608706ec01d9b91283dbce92b293f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-19 20:44:51 +01:00
Joerg Bornemann
d29f76f5e5 Add configure feature 'androiddeployqt'
This makes it possible to turn off the build of the Android deployment
tool.

A new src/tools/configure.cmake is added that will be the place for all
tool-related features in qtbase.

Change-Id: Ic9264c93ee96de06c97d21d2f27f73256f48ffda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-19 20:44:51 +01:00
Øystein Heskestad
18aff2b424 Add more verification when parsing http headers and add tests
Adding tests from QtWebSockets that will reuse QHttpHeaderParser

Task-number: QTBUG-80700
Change-Id: I76294a9156173314a3cf09160d0ca4e0d7c6ef3a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 19:31:34 +01:00
Morten Johan Sørvig
d62e9d3c5b Compile: Work around false positive on gcc >= 900
Change-Id: Id9d2c968322963af6a2e31f0d9e4195120d0b5ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-19 19:26:49 +01:00
Morten Johan Sørvig
471c7e722d wasm: remove duplicate “--bind” option
Not a compile option, and also added to the linker
options above.

Change-Id: Iab2107d4b5ee4bc73e85b3cd5070f1a96b3a5a3b
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-19 19:26:48 +01:00
Morten Johan Sørvig
0d12c9f354 wasm: remove unused variable
Change-Id: I442e3dc4534193709c3510c43a484e5d3c2eb4af
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-11-19 19:26:48 +01:00
Joerg Bornemann
68600869cd Link printer plugins into user projects when using a static Qt
When building a user project against a static Qt on Windows or macOS the
static printer support plugins were not linked.  Move the
Q_IMPORT_PLUGIN statements to qplatformprintplugin.cpp, which is a
translation unit that is guaranteed to be linked into the user project.

Pick-to: 6.2
Fixes: QTBUG-97490
Change-Id: Ic35c6483a664a06461304c7e8a2b7b06ce651ed6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-19 18:48:07 +01:00
Alexey Edelev
a41d9bcac9 Fix generating of Android deployment config in Multi-Config build
Add the config-specific suffix to the generated Android deployment
config file.

Amends d20f4ae706

Change-Id: If1755baf5548adb4d95733477d8b5af85e1fd2dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-19 18:48:07 +01:00
Joerg Bornemann
04ec14105e Change qt.conf key Qml2Imports to QmlImports
[ChangeLog][qt.conf] The key Paths/Qml2Imports has been renamed to
Paths/QmlImports. For backwards-compatibility, Paths/Qml2Imports is
still accepted and acts as default value for when Paths/QmlImports is
not present.

Fixes: QTBUG-98335
Change-Id: If7ffedd281eb8a87e8ab1a2b69a823e615c33541
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-19 16:44:32 +01:00
Marc Mutz
a3303aceeb QLoggingRegistry: avoid double-lookup
The code used the if (!contains()) { insert() } anti-pattern,
necessitated by Qt's deviation from the STL of allowing insert() to
overwrite an existing entry, causing two lookups of the same key.

Fix by recording the size prior to the execution of the indexing
operator and taking a size increase as the cue to populate the (new)
entry. This way, we look up the key only once.

Change-Id: Ica039035fe9ea4b88c20184784c324c9fac33d49
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-19 16:28:45 +01:00
Marc Mutz
7fe5611365 QHash: optimize value(key) and key(value) callers
... by not injecting potentially-expensive temporary objects into the
caller's stack frame.

Default arguments are a convenient way to avoid overloads, but if the
defaulted argument isn't a Trivial Type, and the common use case is
not to pass the extra argument explicitly, the construction of the
temporary can dominate the call's runtime.

Since QHash is generic code, we don't know whether T or Key are
expensive or cheap to construct, so use overloading instead of default
arguments to avoid injecting needless code into call sites.

[ChangeLog][QtCore][Potentially Source-Incompatible
Changes][QHash/QMultiHash] The value(key) and key(value) functions are
now overloaded on presence of the defaultValue (was: defaulted
argument) to avoid injecting temporary objects into the caller's stack
frame.

Task-number: QTBUG-98117
Change-Id: I80fdd5436f3de3e4bbe20242fe45916aef62ff0c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-11-19 16:28:44 +01:00
Edward Welbourne
14b0e2fb1e Prefer QBAV over raw char * form of qt_configure_strs
Passing the QByteArrayView to QString::fromLocal8Bit() ensures we tell
it the size and saves a strlen(). Quite apart from avoiding some
misguided grumbles from compilers, this save searching for a '\0' when
we already know where it is.

Change-Id: I2e3f2edfb4d3bdf488374570567d1dd30641ebc3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-19 16:28:44 +01:00
Eskil Abrahamsen Blomfeldt
cde562cf6d Properly fix QFontDatabase test on Freetype
Amends 4dd5020fbdfdd34f1e4ec54521217e472942a4b4. I messed up the fix for
the XFAIL condition, since the font engine type we get from a normal QFont
will be QFontEngine::Multi regardless of whether the actual font engines
are Freetype or not. Use NoFontMerging to avoid this.

Pick-to: 6.2
Task-number: QTBUG-97995
Change-Id: I2298c997e6826e667dbb8e3d004821f296625ef7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-11-19 15:59:41 +01:00
Pasi Petäjäjärvi
7490937609 Fix test when accessing patched plugin too fast
At least one OS (QNX) can't dlopen() a library that is still
open for writing elsewhere

Pick-to: 6.2
Change-Id: I2d4425d8c69162cdfa43c2523c7459def7839eb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-19 13:30:44 +00:00
Nicholas Bennett
a4dca9936d Docs: Move manifest and androiddeployqt docs to where code lives
Removed content describing androiddeployqt from deployment-android.html
to androiddeployqt.html,the qdoc source now living in qtbase.
Docs src locations added to the qtcore.qdocconf.

Task-number: QTBUG-97842
Pick-to: 6.2
Change-Id: I94783520280098ce1ab35f335a644bea70b8131a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-11-19 12:18:50 +00:00
Kai Köhne
426b2cae7c Remove unneeded int conversions in qmetatype.h
They were added in Qt 5, where QByteArray::reserve() was an int
argument, and qstrlen() was returning an int. In Qt 6, both
accept and return qsizetype/size_t.

As a side effect, this fixes various informational messages when
loading a Qt project into Visual Studio 2022:

  lnt-arithmetic-overflow: A sub-expression may overflow before being assigned to a wider type.

Pick-to: 6.2
Change-Id: Ifc9a1f7046a78bcfb97fe241d697c1bf91c6ba4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-19 12:18:50 +00:00
Eirik Aavitsland
4f69a1e1d2 Clean up line clipping code in rasterizer
Replace old code with the line clipper from qcosmeticstroker.

Also avoids tripping some issue with the current clang 13 that would
cause paint errors on macOS.

Fixes: QTBUG-98403
Fixes: QTBUG-98388
Pick-to: 6.2 6.2.2
Change-Id: I257eeec6f71153ec51b4176df3be8c443938484c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-11-19 12:40:10 +01:00
Mårten Nordheim
919f5bd459 QOperatingSystemVersion: Add Windows11
Change-Id: Ieb7674bbbbc78689f1e2a1e5a06dfd4d0ce25ac1
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-19 09:14:34 +01:00
Marc Mutz
b7f4041669 QAnyStringView: fix broken implicit conversion from QStringBuilder
Need to use QConcatenable<>::ConvertTo for SFINAE, the forwarded type
alias in QStringBuilder itself doesn't work.

[ChangeLog][QtCore][QAnyStringView/QStringBuilder] Implicit conversion
from QStringBuilder to QAnyStringView now works as advertised.

Pick-to: 6.2
Fixes: QTBUG-98138
Change-Id: I1c300675cf43b13017bc56398ae5d8c1c51e64fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-19 03:32:20 +01:00
André de la Rocha
8283df4d8c Windows QPA: Fix multi-touch support in some devices
Some multi-touch devices send touch information for each finger using
different WM_POINTER messages/frames, instead of a single one with
a list of touches, like most devices. This would result in the generation
of multiple touch events, which can cause unexpected behavior in
applications (the QTouchEvent documentation specifies that it should
contain all simultaneous touches). This patch adds a workaround to
ensure all simultaneous touches are included in the events, to comply
with the expected behavior.

Pick-to: 6.2 5.15
Change-Id: I12a2f84b35a6bdd49ee53d25de580c0941a9aea6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-11-18 23:41:02 +01:00
Tor Arne Vestbø
3cc1a32f97 Clarify validity of image returned from QPlatformBackingStore::toImage()
The backingstore may reconfigure the internal data, so clients should
not assume that the image is valid beyond any new operations on the
backingstore.

Pick-to: 6.2
Change-Id: I137ad4f2adb45ec8bb78a989fbb5bac1e72965ce
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-18 23:41:02 +01:00
Tor Arne Vestbø
71f75bf6c5 xcb: Don't mark scrolled area as flushed when doing client side scroll
The m_pendingFlush variable is used to track what is missing in the
server side backingstore. If we're doing a client side scroll the
pending area is still the same.

If we were to always discard the scrolled area from m_pendingFlush
we would get in trouble on the next non-client side scroll, as
we think the content exists server-side.

Pick-to: 6.2
Change-Id: Ie50a99a8e5d8a83d1299c53534a1c83c6bfb47bd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-18 23:41:02 +01:00
Tor Arne Vestbø
12af9ce6db xcb: Ensure we have pixmap GC before trying to flush to it during scroll
Pick-to: 6.2
Change-Id: Icc85b1eb830d8d9b1b2bfb8b9998470388522832
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-18 23:41:02 +01:00
Tor Arne Vestbø
709a932d7b xcb: Prepare correct area when doing client side backingstore scroll
The area we're going to fill is the one after applying the scroll delta.

Pick-to: 6.2
Change-Id: I254830a15e5f4c93ba28ed8f0a9b35c40f1d1af2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-18 23:41:02 +01:00
Eskil Abrahamsen Blomfeldt
7102aa6b15 Fix assert in QFontComboBox when setting empty font
Don't crash if the font does not have any families set.

Pick-to: 6.2
Task-number: QTBUG-97995
Change-Id: I8dc2f2fc00309b6fff6d4a661ec6d659f30808af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-11-18 23:41:02 +01:00
Eskil Abrahamsen Blomfeldt
71faedc5b4 Fix deserializing Qt 5.x fonts through QDataStream
In Qt 5, fonts had both singular family and plural families properties,
and both were stored separately when streaming through QDataStream. The
families list was treated as an extension of family in this case, and
the primary font family was always the singular family property.

In Qt 6, it has been merged into one and family() is now just a
convenience for families().at(0).

But when reading files generated with Qt 5, we would ignore the fact
that these were previously separated. We would first read the family
entry into the families list, and then we would later overwrite this
with  an empty families list.

Instead, we detect streams created with Qt 5.15 or lower and make sure
we append the families list instead of overwriting it in this case. In
addition, we need to make sure we split up the list again when
outputting to Qt 5.x.

This adds a file generated with QDataStream in Qt 5.15 to the test to
verify.

[ChangeLog][Fonts] Fixed a problem deserializing the family of fonts
that had been serialized using QDataStream in Qt 5.

Pick-to: 6.2
Fixes: QTBUG-97995
Change-Id: Id3c6e13fc2375685643caee5f8e3009c00918ccb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-11-18 23:41:02 +01:00
Volker Hilsheimer
4bee9cdc0a macOS: Fix QSlider's knob positioning on Monterey
QMacStyle has a single NSSlider that is used to render any QSlider. For
each QStyle API operating on a slider, the style sets the slider up with
respecive properties. On macOS 12, the NSSlider maintains some states
that make QSlider instances influence each other's knob position when
rendering, resulting in uncontrollable jumping of the slider.

This can be fixed by not using startTrackingAt/stopTracking APIs, which
are however the only way we have to make the slider knob get rendered
pressed - there is no property in NSSlider(Cell), and none of the NSCell
attributes have any effect. So we need to use startTrackingAt, and work
around the side effect by reinitializing the NSSlider by calling
initWithFrame.

This fixes the positioning error, but also causes flickering of the knob
when dragging. To fix the flickering, we have to always call
startTrackingAt for a slider that is pressed, even for calls to
setupSlider that are made in QStyle APIs that are not drawing anything.

Also tried with no complete success (either positiong bug or flicker):
* call prepareForReuse on the NSView
* always call stopTracking on the NSSlider

Fixes: QTBUG-98093
Pick-to: 6.2 6.2.2
Change-Id: I3423b9f7cb125a59831c6722509ab3b74742b6ae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-18 22:06:21 +00:00
Volker Hilsheimer
b3dc0fec2b Add operating system version for macOS 12 "Monterey"
With pre-11 SDKs, macOS reports version 10.16, which already matches
BigSur, so we only match Monterey if version 12 is reported.

Change-Id: I37fee43756310370444981212750cdfe7fad64b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-18 22:53:21 +01:00
Mike Achtelik
f7fd57075b Introduce Q_APPLICATION_STATIC
QObjects must be deleted if the QCoreApplication is being destroyed.
This was previously done by implementing custom code in qtbase and
other modules. So unify it and introduce a Q_APPLICATION_STATIC,
based on the Q_GLOBAL_STATIC, which centralises the logic.

Since we still have a few remaining living QObjects,
this comes in handy to fix those as well.

Task-number: QTBUG-84234
Change-Id: I3040a2280ff56291f2b1c39948c06a23597865c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-18 20:53:27 +01:00
Allan Sandfeld Jensen
1a8b7eb1d4 Increment reference count when restoring reference
Otherwise the count will be wrong after an out of memory failure in
reinterpretAsFormat.

Pick-to: 6.2 5.15
Fixes: QTBUG-98377
Change-Id: Ice51d47a6db9277126a5c7337e14aaf5ddee3a10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-11-18 20:46:41 +01:00
Lucie Gérard
fb33e2a8e8 Add missing QT_TRID_N_NOOP definition
Amends c74bd2b93, properly following up on qttools/bc47b5190.

[ChangeLog][QtCore] Added missing QT_TRID_N_NOOP() macro. Lupdate
actually recognizes it since Qt 5.12.

Fixes: QTBUG-98277
Fixes: QTBUG-3945
Change-Id: I0ea15ceb49b2ead5c8bb40d2a55a0ae8577e8850
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-18 18:13:21 +01:00