Commit Graph

53974 Commits

Author SHA1 Message Date
Edward Welbourne
771657e55f Test the return from sigaction()
If we fail to install our own action, the contents of oldact are noise
anyway, so we can't use them to decide anything; and, in any case, we
didn't replace the prior action, so have no duty to restore it.

In the process, restructure and comment the code to make it easier to
follow what's going on and why. Package a conditional in a lambda to
make the #if-ery less problematic. This should also make it easier to
hack any other complications into the condition, should they arise.

Change-Id: I712335ee27f68a8594dc2fe6441a91f686967da2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-18 18:13:20 +01:00
Edward Welbourne
f75d36fd18 Fix macOS system locale's formatting of negative years
It leaves off the minus sign.

Change-Id: Iad72349368d8849330524144033453cbd79e9e7c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-18 18:13:20 +01:00
Edward Welbourne
8926eb86c6 Fix formatting of dates before 1601 in MS system locale
The relevant MS system calls (say they) don't support date formatting
for years < 1601 (but apparently do in fact) and the year field of the
data structure is unsigned, so can't support years < 0. As a result,
the windows back-end for QSystemLocale failed for negative years.
So replace year < 1601 with a place-holder and substitute after
formatting.

Added new tests (based loosely on one in qtdeclarative that failed) to
verify that this actually works. These reveal that macOS also fails to
handle negative years; marked as expected failure there pending a fix.

Change-Id: I9b63cefd5f0b77a39cf1238549412de3e26ca1bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-18 18:13:20 +01:00
Edward Welbourne
2bf5a60bfa Remove some spurious prefixes in declarations
The parameter-list of a method is already in its class's context, so
doesn't need it made explicit on the other class members involved.

Change-Id: I253b098ad1f2d2db80d49d8f484b7f95d14acec1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-11-18 18:13:20 +01:00
Edward Welbourne
8dea25d501 Add a note on the sign of daylight-saving offsets
Given that at least one zone has a negative offset (so that it's in
standard time for most of the year, including summer, and
daylight-saving time relatively briefly during winter), QTimeZone's
docs should explain what that means.

Change-Id: I6649b4cdefbd685dc97bf85d957960da44d07aed
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-11-18 18:13:20 +01:00
Edward Welbourne
b9021ed1f7 Eliminate a constant from qtimezoneprivate_win.cpp
Its MIN_YEAR was duplicating what's now provided by
QDateTime::YearRange::First, so use that instead.
In the process, tidy up an over-long line.

Change-Id: I109f5435f63cb5cc97d54529a172b640f919dec0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-18 18:13:20 +01:00
Edward Welbourne
28088a3d74 Remove some unused constants from qtimezoneprivate_win.cpp
Recent commit 6845c444d0 elicits
warnings about two unused constants. Remove an unused macro at the
same time, and add missing LL suffix to remaining qint64 constants.

Change-Id: I4c84e10b512030e0e4f860d434382e62e6c936f5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-18 18:13:19 +01:00
Marc Mutz
34c7018a52 multistreamserver: fix compilation
Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.

Amends 8bd0a09475.

Pick-to: 6.2
Change-Id: I077948b33f985cd4a2e3a9e591645cf20d7af91c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-18 18:13:19 +01:00
Marc Mutz
dca63b6ef6 QIODeviceBase: make dtor protected
Base class dtors should be virtual and public or else protected and
non-virtual. This one was neither of these.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
QIODeviceBase destructor is now protected to avoid deleting objects of
classes derived from it through a QIODeviceBase pointer, which would
be undefined behavior.

Change-Id: Id390ace75d5b64f746d9b1865b8800c9f0590977
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-18 17:13:19 +00:00
Marc Mutz
0e245c158f Add an initial tst_QAnyStringView
It's incomplet, but at least something.

Task-number: QTBUG-98138
Pick-to: 6.2
Change-Id: I4630a44b62b190dee8a8cc07822dd6ec67dbdc84
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2021-11-18 17:13:19 +00:00
Ievgenii Meshcheriakov
0fa6e6b0ab QFileSystemEngine: Fix permissions query in Windows backend
Make fillPermissions() correctly set OtherExecutePermission
instead of OwnerExecutePermission.

Pick-to: 6.2
Change-Id: I77ef3c5bc59ac6110c5a461a599d03029c70493c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-18 17:12:27 +01:00
Tatiana Borisova
05acb9e2b9 Delete -Wextra compilation flag for GHS compiler
- GHS compiler doesn't have -Wextra flag and it leads to huge count of warnings.

Pick-to: 6.2
Change-Id: Id2ba654a49fb163bebc75e3a22ecaa1895ecdbe8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-18 09:38:43 +00:00
David Schulz
35263fffea Always check keyboard modifiers when generating mouse events
This is basically a revert of: 634ce491e8

The cached keyboard modifier can get out of sync when switching to
another application while a modifier is pressed. In this case we get a
key press event but we might not get the key release event, which is
expected to reset the cached modifier. Switching back to the Qt
application after the modifier was released now still has the old
modifier cached.

Most prominent example is triggering alt + tab to switch to another
application and use the mouse to get back to it. In this case the alt
modifier is still cached.

Task-number: QTCREATORBUG-26581
Pick-to: 6.2
Change-Id: I9d64b7d730af089778bd1a4b3f1296bcccd5d16d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-18 06:44:26 +01:00
Yuhang Zhao
16aa4eaa82 QOperatingSystemVersion: Add Win10 sub-versions
Change-Id: Icce32a17f285f0a0416ad8a7838a7424cda2bc2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-18 13:34:49 +08:00
Volker Hilsheimer
79b2a43585 Add baseline test that allows comparing the rendering of widgets
Provide basic boiler plate that sets up the baseline (aka lancelot)
framework specifically for comparing the appearance of widgets, and
implement test functions for QSlider and QPushButton.

Widgets should always look the same if the QPA platform, the OS
version, and certain UI-impacting attributes are identical. Ie.
on any macOS 10.15 machine that runs in "Light" mode, widgets
look the same. On a macOS 11 machine, they might look different.
On an OpenSUSE machine using the fusion style things might look
different from a Ubuntu machine.

The helper function removes DPR differences - images are always
scaled to a DPR of 1.0, which allows us to compare the image\
content and not get distracted by them having different dimensions
(and the fuzzy comparison of images might make the system tolerate
scaling artefacts).

Note: For now, this test is meant to be run locally, either when
testing changes to style code, or when checking how QWidget based
UIs would look on newer version of an operating system. In CI the
test is run, but then skipped in CI as the baseline server is
not configured.

Change-Id: Ie33a9d979d934f0df6883757333ce2c5e2f7ef84
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-18 03:36:24 +00:00
Edward Welbourne
3b84187cd1 Fix leak in date and time formatting on macOS
CFDateFormatterCreateStringWithDate() creates a CFStringRef that we
need to tidy up once we're done with it, so use the QCFType template
to take care of that.

Change-Id: Ibc3751426cc4496bce25307918fdb11722cde3b2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-18 04:36:24 +01:00
Tor Arne Vestbø
a8a003aba2 Build ODBC driver as universal binary on macOS
Task-number: QTBUG-93204
Pick-to: 6.2
Change-Id: Ia373f41dbf247c8a5844ae365701bc457cfba79d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-18 04:36:24 +01:00
Povilas Kanapickas
b00fe3c9aa CMake: Enable -bundled-xcb-xinput by default
This is done by disabling system-xcb-xinput feature by default. It will
require user to pass -no-bundled-xcb-xinput to the configure script to
override this.

The reason for the change is that touchpad gesture implementation
requires new code from libxcb, yet this new code is not even released
yet. Even if it was released today, at least several years will pass
until the new version is common enough.

[ChangeLog][Third-Party Code][X11] The xcb plugin is now compiled with
the bundled xcb-xinput library by default, in order to enable support
for touchpad gestures.

Change-Id: Iebb27ecee7facf070ef23f37a55aab0578698f16
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-11-18 02:32:58 +02:00
Marc Mutz
536471106d QAbstractFileEngine: fix UB (data race) on qt_file_engine_handlers_in_use
While all writers of the variable hold fileEngineHandlerMutex for
writing, the qt_custom_file_engine_handler_create() function checks
the value before entering a fileEngineHandlerMutex read-side critical
section, thereby causing a C++11 data race.

Fix by making the variable atomic. Interestingly enough, relaxed
atomic operations suffice here, since the actual synchronization
happens in read- and write-side critical sections, and if
qt_file_engine_handlers_in_use is wrong w.r.t. to the actual list, the
critical sections will still work. We just mustn't cause UB by reading
and writing to a simple bool without proper synchronization.

Pick-to: 6.2 5.15
Change-Id: I30469504cdbc90e2ab27125181e53d74305f13fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-16 21:16:28 +01:00
Marc Mutz
06dfbdf081 QItemSelection: fix (some) O(n²) behavior in merge()
Instead of taking a copy of the incoming data, followed by a quadratic
modifying algorithm (single-element erase loop), guaranteeing a
deep-copy detach of the original, just iterate over the incoming data,
building the new dataset by appending only valid items.

Also port to ranged for loop.

There's more quadratic behavior in that function, later on, but that's
for another patch.

Change-Id: I284f3b7c9694c8eb226a198f6f97538765113b19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-16 20:37:32 +01:00
Eirik Aavitsland
997c052db9 Reject truncated and corrupt ascii pnm images
In contrast to the binary decoder code, the ascii decoder would not
abort and fail on premature end of file.

Pick-to: 6.2 6.2.2 5.15 5.12 5.12.12
Change-Id: If27bce0afa8d1de6c4dbeb2bc0e623c1dcc2f1e0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-16 18:54:32 +00:00
Tor Arne Vestbø
99bb78f6c2 macOS: Clear NSOpenGLContext drawable when QNSView is about to go away
Calling doneCurrent() on a QCocoaGLContext only clears the current
context, but doesns't reset the drawable (view) of the context. In
most cases this is fine, but it has been observed to cause issues
when using the software GL renderer on Big Sur and above.

To be a good citizen we clear the drawable of any of our contexts
that are tied to the NSView this about to be go away.

Pick-to: 6.2 6.2.2
Change-Id: I8c845727c50871f30fbebc2ed62a7d0485651ecf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-11-16 18:54:32 +00:00
Kai Köhne
550e02b809 Make missing xmlstarlet command just a status message
We don't list xmlstarlet in the install documentation, also
because the affect on code size is not too big. We therefore
also don't print a CMake warning then.

Pick-to: 6.2
Change-Id: Ifad3ef0106d09640a7c7d1736f4d5382bcf18e35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-16 18:37:38 +01:00
Kai Köhne
b99adf7a81 Do not include qloggingcategory.h in public headers
Reduce overhead for including qguiapplication.h by splitting
up qnativeinterface.h into a public and a private part.

[ChangeLog][Potentially Source-Incompatible Changes] The
qguiapplication.h header no longer implicitly includes
qloggingcategory.h. If your code depends on the transitive
include, explicitly include <QLoggingCategory> where needed.

Pick-to: 6.2
Task-number: QTBUG-97601
Change-Id: Ic02327a1c3092e21730160af5c59a9d58dc1239c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-11-16 17:26:04 +00:00
Marc Mutz
61d5783ba8 tst_qsctpsocket: fix compilation
The header for QTestEventLoop hadn't been included.

Pick-to: 6.2
Change-Id: Ife3418d1634c030c421c2aa55469f5a099386d4b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-16 15:07:36 +01:00
Marc Mutz
8bd0a09475 multistreamclient example: fix compilation
Says GCC:
  qtbase/examples/network/multistreamclient/timeconsumer.cpp:85:37: error: incomplete type ‘QIODevice’ used in nested name specifier
     85 |     QDataStream ds(&buf, QIODevice::WriteOnly);
        |                                     ^~~~~~~~~

Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.

Pick-to: 6.2
Change-Id: Id8d87dbcb497e4feca1d5d3ce6b1bdb9da5c0dab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-11-16 15:07:36 +01:00
Eirik Aavitsland
e8f93e38de Rename and restructure the baseline (lancelot) testing code
In preparation for addition of new baseline tests, establish a new
test category, "baseline". This is similar to the category
"benchmarks" in that it contains tests that use the QTest framework,
but conceptually are not unit tests, in contrast to those under auto/.

Move the existing QPainter baseline test, tst_lancelot, into this new
category, and rename it accordingly.

Baseline tests use the QBaselineTest extension to QTest. Move that
extension too into the tests/baseline directory, allowing the clean
out of the baselineserver directory.

Pick-to: 6.2
Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-16 14:01:50 +01:00
Zhang Hao
9a131b59ee QFontComboBox don't response qApp fontDatabaseChanged()
If QFontComboBox is instantiated in the form of new and call
QFontDatabase::addApplicationFont, QFontComboBoxPrivate::_q_updateModel()
will be called when the program exits, at this time qApp will crash.
Fix this by when program exiting, QFontComboBoxPrivate don't need
call _q_updateModel().

Fixes: QTBUG-98099
Done-With: Konstantin Ritt <ritt.ks@gmail.com>
Pick-to: 5.15 6.2
Change-Id: I3df3d19c3d1971288d60f2eef386262befbf396b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-11-16 17:21:56 +08:00
Giuseppe D'Angelo
78a8e561b2 QRegularExpression: do not mark as dirty on no-op setters
Quite some code in Qt takes a copy of a QRegularExpression and then
changes something on it (e.g. the case sensitivity) based on some
other criteria:

  QRegularExpression copy = orig;
  if (cond)
    copy.setPatternOptions(copy.patternOptions() | CaseInsensitive);
  use(copy);

This pattern can be found in QAIM, QString-related classes, and so on.
The "problem" is that if the attempted modification is a no-op, we'd
still invalidate the copy object (by detaching). Even if no detaches
are involved, setting the same pattern or options on a QRE object
shouldn't require a relatively expensive pattern recompile.

In summary: don't detach/mark a QRE object as dirty if a setter didn't
actually do a modification.

Change-Id: Iae0ab4a5e443e7285a83d3d7e0f1dcfd66e8d51d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-16 10:21:09 +01:00
Marc Mutz
ab67a6b126 tst_qvariant: fix -Wclass-memaccess
The source was already protected, but the destination wasn't.

Pick-to: 6.2
Change-Id: I300f19c3e65abd8bc1eef4309aefa11852d1c049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-16 06:46:52 +01:00
Marc Mutz
0b3f4f8f5a QReadWriteLock: replace a QHash with a QVarLengthArray<., 16>
The QHash was used to track the recursion level of concurrent
readers. But it makes no sense to optimize this data structure
for O(1) lookup speed, since once you go beyond a few threads,
a mutex-based solution falls apart, anyway.

So use an unordered QVarLengthArray with preallocated capacity
16 instead. Lookup and erasure are now O(N), but tracking the
first 16 threads that concurrently lock this shared mutex for
reading no longer allocates memory (except for the Private
class that contains the data structure).

Results on my machine (recursive only):

  thread count: 16
  ********* Start testing of tst_QReadWriteLock *********
  Config: Using QtTest library 6.3.0, Qt 6.3.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.2.1 20211101), ubuntu 20.04
  [...]
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, read, recursive: 1)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read, recursive: 1":
  -     51 msecs per iteration (total: 51, iterations: 1)
  +     38 msecs per iteration (total: 77, iterations: 2)
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, write, recursive: 1)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write, recursive: 1":
  -     31 msecs per iteration (total: 62, iterations: 2)
  +     29 msecs per iteration (total: 58, iterations: 2)
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, read, recursive: 2)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read, recursive: 2":
  -     89 msecs per iteration (total: 89, iterations: 1)
  +     75 msecs per iteration (total: 75, iterations: 1)
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, write, recursive: 2)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write, recursive: 2":
  -     62 msecs per iteration (total: 62, iterations: 1)
  +     56 msecs per iteration (total: 56, iterations: 1)
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, read, recursive: 32)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read, recursive: 32":
  -     1,357 msecs per iteration (total: 1,357, iterations: 1)
  +     1,154 msecs per iteration (total: 1,154, iterations: 1)
   PASS   : tst_QReadWriteLock::uncontended(QReadWriteLock, write, recursive: 32)
   RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write, recursive: 32":
  -     1,067 msecs per iteration (total: 1,067, iterations: 1)
  +     984 msecs per iteration (total: 984, iterations: 1)
  [...]
   PASS   : tst_QReadWriteLock::readOnly(QReadWriteLock, recursive: 1)
   RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock, recursive: 1":
  -     11,561 msecs per iteration (total: 11,561, iterations: 1)
  +     6,704 msecs per iteration (total: 6,704, iterations: 1)
   PASS   : tst_QReadWriteLock::readOnly(QReadWriteLock, recursive: 2)
   RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock, recursive: 2":
  -     16,173 msecs per iteration (total: 16,173, iterations: 1)
  +     13,053 msecs per iteration (total: 13,053, iterations: 1)
   PASS   : tst_QReadWriteLock::readOnly(QReadWriteLock, recursive: 32)
   RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock, recursive: 32":
  -     178,597 msecs per iteration (total: 178,597, iterations: 1)
  +     146,008 msecs per iteration (total: 146,008, iterations: 1)
  [...]
   PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock, recursive: 1)
   RESULT : tst_QReadWriteLock::writeOnly():"QReadWriteLock, recursive: 1":
  -     65,165 msecs per iteration (total: 65,165, iterations: 1)
  +     64,503 msecs per iteration (total: 64,503, iterations: 1)
   PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock, recursive: 2)
   RESULT : tst_QReadWriteLock::writeOnly():"QReadWriteLock, recursive: 2":
  -     70,665 msecs per iteration (total: 70,665, iterations: 1)
  +     69,812 msecs per iteration (total: 69,812, iterations: 1)
   PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock, recursive: 32)
   RESULT : tst_QReadWriteLock::writeOnly():"QReadWriteLock, recursive: 32":
  -     50,811 msecs per iteration (total: 50,811, iterations: 1)
  +     57,659 msecs per iteration (total: 57,659, iterations: 1)

Recursive mode is really, really expensive, even with this patch applied.

Change-Id: I36a164cf09462b69dce7e553f96afcebb49e3dbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-16 06:46:48 +01:00
Marc Mutz
98bb6d23a1 QString: prefer sliced() over mid() in split-like functions
These algorithms never call mid() with funky values, so they don't
need the mid() side-cases, and associated 7-branch deep conditionals.

Just use sliced().

Change-Id: I05b6a0e47da90f09b34a92211f7e783a2db709f7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-15 23:37:31 +01:00
Ulf Hermann
1ea1e0d7f3 Document QLibraryInfo::Qml2ImportsPath as deprecated
Also, add a TODO for migrating to QmlImportsPath in qt.conf.

Task-number: QTBUG-98335
Change-Id: I3c321c99c6286ba64eef643876f5b56d5a8ca695
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-15 21:41:43 +01:00
Assam Boudjelthia
dfb4b7856a Android: check if objectClass() is not null in registerNativeMethods()
In case the class doens't have a default constructor, checking for
object.isValid() will give false because the object won't be created,
however, the class could still be loaded and we could have a valid
jclass.

Pick-to: 6.2
Fixes: QTBUG-96069
Change-Id: I8d59e26d9d7c0e8e363ce443937091a374a24473
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2021-11-15 19:00:21 +00:00
Edward Welbourne
f3e2689106 Revise (recently-added) yearSharingWeekDays() to take a QDate
This lets it avoid a two-digit year that would clash with month or day.
That shall make fixing up system locale date formatting run cleaner.

Add a test for QGregorianCalendar's two extensions.

Change-Id: I77083ff9d5e4035763250904a59fcf416286545b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-15 20:00:21 +01:00
Tor Arne Vestbø
e6364f9c9c Build PostgreSQL driver as universal binary on macOS
Task-number: QTBUG-93204
Pick-to: 6.2
Change-Id: I3e7c76411a7bebee9105a9d97b6ca2c4128a8ddc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-11-15 19:02:07 +01:00
Volker Hilsheimer
22634e0079 Make sure we paint overlapped children and siblings when moving far
In paintAndFlush, QWidgetRepaintManager subtracts opaque children if
the target isn't overlapped and isMoved is set to true. So in moveRect,
set isMoved to true after the blitting of movable areas, and reset it to
false if we have overlapped sibling or child regions. Otherwise, moving
so far that sourceRect is invalid (none of the original pixels are
visible after the move) we end up in a code path that sets isMoved to
true even with overlapping children or siblings, which then breaks
paintAndFlush's assumptions.

Reuse the test case written by Sergiy Korobov <tiamatenko@gmail.com> in
earlier attempts to fix this bug.

Fixes: QTBUG-26269
Pick-to: 6.2
Change-Id: If7443863f5eee79a80220cd587522122f42a21e4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-11-15 18:25:50 +01:00
Povilas Kanapickas
9879d41d05 xcb: Implement support for touchpad gestures
They map to the data exposed by libinput exactly the same way as
touchpad gestures on Wayland. The implementation is functionally the
same and follows the same patterns to preserve similar behavior across
X11 and Wayland.

For example, we use the last known pointer position as the position for
gestures, even though on X11 this data is available as part of events.

The new implementation is only enabled if the used xcb supports the
required APIs.

[ChangeLog][Platform Specific Changes][X11] Touchpads can now detect
multi-finger gestures and send RotateNativeGesture, ZoomNativeGesture
and PanNativeGesture events, since XInput 2.4 and X Server 21.1.

Change-Id: If404dcf8385210deadeb7e7c6d29171e9abc9e50
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-11-15 15:51:14 +00:00
Li Xi
a0e7fbd4d5 Test result of qobject_cast before dereferencing
Since QMainWindow::setMenuWidget accepts a QWidget (allowing users to
implement their own menu widget), we need to use qobject_cast on the
stored widget to see if it is a QMenuBar before calling QMenuBar APIs.

This qobject_cast may return nullptr.

Pick-to: 6.2
Fixes: QTBUG-98247
Change-Id: Iff1dbd24fa7ca09098fe49c179770356c966251d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-15 16:51:14 +01:00
Volker Hilsheimer
61aa482241 QTabBar: Support scrolling with a kinetic wheel
QTabBar implements wheelEvent to move the current index up or down. This
is useful for clicky mouse wheels, but a bad user experience when using
a kinetic wheel or touch pad, as every pixel movement will change the
current index.

Instead, scroll the entire tab bar when the wheel event comes from a
device that supports scroll phases, without changing the current index.

As drive-by's, fix the test introduced in aa09bea00c to
not leak memory or leave a test-specific style set on the QApplication
instance, which can break other tests.
Also, make relevant layout code in QTabBar respect the usesScrollButtons
property, const'ify local variables, and return an accepted QWheelEvent
if the event resulted in a change.

[ChangeLog][QtWidgets][QTabBar] Scrolling with a kinetic wheel or touch
pad scrolls the entire tab bar, without changing the current index.

Change-Id: I990e51466dd25c741877bbf0e197449f897a9efb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-11-15 16:23:42 +01:00
Marc Mutz
ee4f69205a QReadWriteLocker: also benchmark recursive mode
Change-Id: Ic2e357f4702d05220cf6c96717672dcabacd78d6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-15 15:17:26 +01:00
Toni Saario
01927d80fd Set emscripten environment for webassembly
Change-Id: I4d99e72086673a19fe5ac487aefd6b20a0d3a637
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-11-15 16:17:26 +02:00
hjk
2fa29b00ca Fix return type documentation of QFileSystemModel::fileName()
Pick-to: 6.2
Pick-to: 5.15
Change-Id: I5de4214766eccd5b0086d1230b4267fb49e1b58f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-11-15 13:46:46 +00:00
Sona Kurazyan
65d553ce52 QFuture: extend the docs to explain how to cancel continuation chain
Task-number: QTBUG-97582
Change-Id: Ib31d0dfb7a74bb88802a21c5875edd789e412529
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-15 13:24:24 +01:00
Sona Kurazyan
76a551588c Update documentation of QFuture continuations
Mention that the futures returned by continuations will stay
uninitialized, until the corresponding continuation/handler starts
executing and do some general improvments to make the docs more
readable.

Task-number: QTBUG-97582
Pick-to: 6.2
Change-Id: I141ff1630b22ec7a856a457a41a69efec980d44b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-15 13:24:24 +01:00
Volker Hilsheimer
6ff07ec23b macOS: make the slider knob big enough for BigSur and Monterey
The slider is very touch friendly from macOS 11 on, and the knob is quite
large. Give it some extra pixels, and adjust the test accordingly.

Pick-to: 6.2
Task-number: QTBUG-98093
Change-Id: Iedf6db1081cdd4013ca29ce760aea1e0361b1123
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-11-15 09:30:25 +01:00
Sona Kurazyan
eab40726be QFuture: support cancellation of continuation chain through parent
This change allows canceling the chain of continuations attached to a
future through canceling the future itself at any point of execution of
the chain.

[ChangeLog][QtCore][Important Behavior Changes] The chain of
continuations attached to a future now can be cancelled through
cancelling the future itself at any point of the execution of the chain,
as it was documented. Previously canceling the future would cancel the
chain only if it was done before the chain starts executing, otherwise
the cancellation would be ignored. Now the part of the chain that wasn't
started at the moment of cancellation will be canceled.

Task-number: QTBUG-97582
Change-Id: I4c3b3c68e34d3a044243ac9a7a9ed3c38b7cb02e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-13 18:13:08 +01:00
Povilas Kanapickas
746644a5a9 3rdparty: Add touchpad gestures support to bundled xinput xcb module
This feature can easily be backported to our bundled version of libxcb
because the feature is pretty much self-contained (just a couple of new
events and parsing support) and does not depend on newer features of
libxcb that have appeared since our bundled version of 1.13.

Change-Id: If965e3de8b898286cd61c7fddbf335894f3a3ff5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-11-13 17:58:45 +03:00
Andrei Golubev
2a2fb306b8 QStack: simplify the class (even more)
Most methods just do the same thing that is implemented in QList,
so just use QList methods

The QStack::pop() implementation should no longer go through the
resize which is likely slower, expands to more-code (unless optimized
away neatly) than erasure of single element through QList API (which
we optimized at some point to be fast)

It is also meaningless (afair) to have `inline` keyword when a method
is both declared and defined within the class' body, so we can drop
that as well

Change-Id: If9de3429be7418ed0ae13c571e28556a358eab05
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-12 22:25:35 +01:00
Mårten Nordheim
3446313c7a Teach QOperatingSystemVersion to handle new OS entries in patch releases
Adding new entries to QOperatingSystemVersion in patch releases
was previously breaking our BC guarantees because the entries are
exported, thus users cannot freely switch between different
patch-releases without a recompile if they adopted the new entries.

Move the data itself to a base class so that the entries can be
constructed inline.

Task-number: QTBUG-97808
Change-Id: Ic44f07488af8a04a3bedc10bebb740c4d68f43f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-11-12 18:06:44 +01:00