To be used to build QVectors out of Q_ARRAY_LITERALs.
Change-Id: I6105fd1f2d13f6ce923b79276b4aa7a7f5eff193
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
81e298a51d fixed a case where the focus
chain was screwed up when the order was already correct. This worked
correctly in most cases but not when the next focus widget of the first
one had Qt::NoFocus.
The optimization check if lastFocusChildOfFirst is the same as second is
thrown away since it now does not longer screw up the focus chain and
the save would only be four pointer assignments.
Fixes: QTBUG-75388
Task-number: QTBUG-10907
Task-number: QTBUG-68393
Task-number: QTBUG-69619
Change-Id: I581ed532156c34ea970123afd063194aab016304
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Explain why there are two accessor functions for the global statics,
and use the global statics directly inside qapplication.cpp for
consistency.
Change-Id: Ibf3952052c1d0e780a8aab220a72f05af0c070a5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
initSystemPalette() already takes care of this.
Change-Id: I6521763a74ec3ec629d9fcf05aa2a7cd71a7f26d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
initSystemPalette() already calls this when there's a platform theme, which
is the only case where initializeWidgetPaletteHash will have an effect.
Change-Id: I814ea2bb17ef40aee769f2c36f8ef4296cfca020
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Only uses a single place and avoids following the init logic through
multiple layers when trying to debug it.
Change-Id: I8fc119385edf407f69fb5431dc6584288022a7fe
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The code was added in 2005, ifdefed out already, and never used.
Change-Id: Ic5d070dd031665a4429739278851b50646694bf9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
QMacStyle polishes QMdiSubWindows to have autoFillBackground set to
false. If the QMdiSubWindow's widget also doesn't fill the background
(like QLabel), then nobody fills the window in a tabbed QMdiArea, and
the other subwindows show through.
This change makes sure that all pixels are painted in that situations,
using the styled frame.
Fixes: QTBUG-76214
Change-Id: Iae025d15d36a8bc0d0c5838ac43c9d54944bcc83
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QSslSocket (OpenSSL backend) does not use mutex/locks during
a handshake, so we re-enable previously skipped tests.
This reverts commit 8c87a1402c.
Change-Id: I994b085f016f0eb18b3ba439a7041ea08cd3577b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is to support rare setups involving an X11 server with multiple
independent displays ("zaphod heads" on which the DISPLAY env var
is different), possibly with multiple outputs forming a virtual desktop
on each display.
QMenu::popup() has been assuming that it should show on the screen where
the mouse cursor is. That's good most of the time; but with multiple
independent screens, QGuiApplication::screenAt(pos) cannot tell us which
screen to use (it's ambiguous), but rather will choose the first screen
that _could_ contain that position (as documented). In the example in
QTBUG-76162, the QMenu has been constructed with a QDesktopScreenWidget
as its parent specifically for the purpose of telling it which screen to
pop up on; so we need to respect that. But QWidgetPrivate::init() sets
the QObject::parent() to null (because the widget isn't actually shown
as a child of the QDesktopScreenWidget), and QWidgetPrivate::create_sys()
sets initialScreenIndex back to -1 to provide freedom to change the
screen later; so QMenu has to remember the screen index for itself.
QMenuBarPrivate::popupAction() searches the siblings of the screen on
which the menubar is claiming to be (rather than all screens on all
displays), to find the screen containing the point at the middle of the
bottom edge of the clicked menubar item. It then sets initialScreenIndex
so that QMenu::popup() will respect it rather than trying to decide for
itself.
Fixes: QTBUG-76162
Change-Id: I7a8f8e7aa2e9cf5340d446dc12726369ebe2589a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
GNOME indicates DPI modes by setting high DPI values in Xft.DPI, so
we need to use the forced DPI setting instead of the real DPI, as basis
for QPA pixel density.
Change-Id: I6f25636383b16b89a3d5fe4c904afd079fe001aa
Fixes: QTBUG-74836
Task-number: QTBUG-65424
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Converting an out-of-range FP to integer is UB. See comment in
qnumeric_p.h.
Change-Id: Ief874765cd7b43798de3fffd15a9bfe2c5fbbc01
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This is the worst fix ever, adding one more qWait. The test has been
updated in the 5.13 branch, so there a different fix will be needed. For
now this is in line with the rest of the code.
This test is currently one of the worst offenders when it comes to flaky
tests.
Task-number: QTBUG-64639
Change-Id: Ia1e71cc948997408b9658839013c9ad098111033
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
When our QSslSocketBackendPrivate (OpenSSL backend) was developed,
the ancient versions of OpenSSL did not have an API needed to pass
an application-specific data into verification callback. Thus the
developers resorted to the use of global variables (a list with errors)
and locks. Some of our auto-tests use QNAM and in-process server.
Whenever the client (essentially qhttpthreadeddelegate) and the server
live in different threads, any use of 'https' is dead-lock prone,
which recent events demonstrated and which were previously observed
but not understood properly (rare occasions, not always easy to
reproduce). Now we fix this for good by removing locking.
There are two places (in 5.12) where these locks are needed:
1. Before calling SSL_connect/SSL_accept (handshake) - here
we reuse the same trick we do in PSK callback ('SSL' has
an external data set, and it's 'this', meaning an object
of type QSslSocketBackendPrivate).
2. The static member function 'verify', here we do not have
'SSL', but we have our temporary 'X509_STORE', to which
we can directly attach an external data - a pointer to
a vector to collect verification errors.
Note, this change assumes that OpenSSL Qt is build/linked
against is at least of version 1.0.1 - we set external data
on SSL unconditionally (no version checks).
Fixes: QTBUG-76157
Change-Id: I05c98e77dfd5fb0c2c260fb6c463732facf53ffc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We read the data into the iterator from the system, but then recreate
the QStorageInfo object based on the rootPath, and then stat, discarding
the data in the iterator.
We can overwrite the data with the information in the iterator, which
partially fixes the issue. Volume information that can only be retrieved
by stat'ing the root path, such as size information, will only be
correct for one of the entries.
Change-Id: Ie98590876d6a5f525af009f4ff5d595cbc308b3f
Fixes: QTBUG-63209
Reviewed-by: Andrius Štikonas <andrius@stikonas.eu>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows us to drop QString::multiArg() from the build as soon as
we can break BC, ie. in Qt 6.
Change-Id: Ibdfbf9e9586952e0ec125120bb5966eb56c0ce67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Saves more than 4KiB in text size (~0.7%) on optimized GCC 9.1
Linux AMD64 builds.
Change-Id: I5b29eae620370abd91e3a7f98e660c32470aed1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Saves ~600B in text size on optimized GCC 9.1 Linux AMD64 builds.
Change-Id: I12f4e7c8d28af9549b481859bc96a155aeb6f15c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
With the new variadic QDBusAbstractInterface::call() API,
this saves ~5KiB in text size on optimized GCC 6.1 Linux
AMD64 builds.
Change-Id: Idc43bb07083f98b4b652d7331e545ba79be1e296
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This version of arg(), unlike its QString counterpart, transparently accepts
views without conversion to QString, and is also extensible to further argument
types, say a future QFormattedNumber.
[ChangeLog][QtCore][QStringView/QLatin1String] Added arg(), taking arbitrarily
many strings.
Change-Id: If40ef3c445f63383e32573f3f515fdda84c7fe3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The pointer value is not the only data we're interested in, but
instead points to indirect data, so we need a release fence on store
(present) and a corresponding acquire fence on load (was missing).
Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSignalSpyCallbackSet is a set of pointers, so when we store a pointer
to it for later dereferencing, we need to use a release fence for the
store and a corresponding acquire on load, lest the two don't
synchronize with each other and we end up with a data race.
Amends a65752c71b.
Change-Id: Ic2983d76237c5c5b00eb2a3575b10beb84d57190
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... and use a variant of the QString::multiArg() trick to pass the
variable number of arguments into an out-of-line function.
The idea of this patch is to make the lowly asyncCall() and call()
functions the principal interface for DBus calls again.
Currently, it is more efficient to build up a QList<QVariant> and pass
that to the *WithArgumentList() methods. With more efficient, I mean
that the equivalent calls with QList expand to less client code,
probably because of the need to construct eight QVariant instances,
destroy them again, and then take the hit for a function call with so
many arguments, which can all but be efficient.
Consequently, when porting the NM bearer plugin to use call() instead
of callWithArgumentList(), text size increased by ~3KiB on my machine.
So, looking for a way to avoid the overhead of so many default
arguments, while at the same time allowing to pass even more arguments
than the predefined eight, I considered the QString::arg() method, but
discarded it because it does not scale to arbitrarily
(ie. SEP-limited) many arguments.
Variadic templates scale to SEP-limited many arguments, but they are
templates and deduce the exact type, so constraining the template to
only QVariants would have broken all users of the API which pass
non-QVariants and expect an implicit con- version to resolve the call.
So I decided to make a virtue of necessity, accept all argument types
and convert them to QVariant when constructing the
QString::multiArg()-inspired QVariant array.
To bring this patch to its consequential end would require to pass the
arguments as arrays instead of QLists, but to get a feeling of how
much impact this new API has, I backed the new implementation by
converting the array to a QList and calling the *WithArgumentList()
methods.
The result is, if I may say so, satisfying. Said bearer plugin drops
from +3KiB (baseline: callWithArgumentList()) to -5KiB (2.0% and 3.2%,
resp.); the (unmodified) connman bearer plugin, which already used
call(), dropped by almost 6KiB (2.5%).
While GCC can deal with the zero-sized array in a nullary call to the
variadic templates, MSVC cannot, so an extra overload provides an
alternative for zero arguments.
[ChangeLog][QtDBus][QDBusAbstractInterface] The call() and asyncCall()
methods now accept more than eight QVariant arguments.
Change-Id: Ic85faca40949f9bb8c08756be3bfe945c9cdd952
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
E.g. as seen on Integrity:
"global/qglobal.cpp", line 2967: warning #111-D: statement is unreachable
Change-Id: I6845192ee7fb14b66700b68118355c871b1a4baf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Now that it's trying to guess whether the type is markdown based on
the file extension, there needs to be a way to override it. For example
it might be arranged that directory listings will be generated in
markdown format instead of HTML; then when loading a source URL that
is a directory, the application may override the type. The type for
the single-argument setSource(url) is UnknownResource to preserve
the existing behavior, but the user can override the guessing by
setting a specific type.
Change-Id: Id111efd24de7d8fd18c47b16a2d58f5b09d77891
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
The code didn't really use the queue as a queue, because it enqueued
one at a time, but dequeued potentially many. Even if it actually
decays to actual queue behavior: for the small number of elements
expected, a vector would still be preferable over the per-element
allocation performed by QQueue.
Because std::vector doesn't have pop_front(), I took the liberty of
making the dequeue code easier to read by using find_if with an
aptly-named lambda.
Change-Id: I09bd7ede50cb8ab5af5d1fc2ede37a3731f67070
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It's a 38k source file, which makes it MUCH smaller than other generated
files like qlocale_data_p.h (982k) and qunicodetables.cpp (718k). The
constants are platform-independent, since they are defined by IEEE 754,
so they will never change.
The generator tool is moved to util/ and removed from the build. That's
one fewer bootstrapped tool to have to worry about.
The output file is committed as .cpp so it won't get installed.
Fixes: QTBUG-76165
Change-Id: I2b1955a995ad40f3b89afffd15a3ded58dc3e35f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
It doesn't really need Qt. So remove the dependency. I've confirmed that
the output is identical to what used to be generated.
This ought to be replaced by a script. Or just committed to Git, since
the generated output is not really supposed to change, ever.
Change-Id: I46363e5b8944459e8c48fffd158bb5d74fb6184c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When using a texture for foreground color in text and copy-pasting
the text inside the same QTextEdit, the formatting would disappear.
Fixing this in a general way would require implementing some
other carrier format in the mime data than HTML, such as e.g ODF,
but it can quite easily be fixed for the case where the data
is pasted in the same document, or even different documents
as long as they have a reference to the image in the formats.
[ChangeLog][QtWidgets][QTextEdit] Added support for copy-pasting
foreground brushes with textures within same document.
Task-number: QTBUG-75931
Change-Id: I8b39dce289c64eea39e25cb8eb207e2534bcd2eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
First, we cannot quote the whole command in double quotes, since the
command itself very often have double quotes inside it.
Secondly, we should use the same that the ssh(1) command does:
Instead of adb shell setprop foo 'a b' we should use
adb shell setprop foo "'a b'" as explained here:
[https://developer.android.com/studio/command-line/adb#shellcommands]
Last hunk in isRunning():
The pipe character got eaten by the shell if we used a single quote (so
the stuff after the pipe (grep) was actually run locally).
Switching to ssh-style quoting fixed that.
Change-Id: I3075cdf8595ac2549cec8019f2cba79f77815e0b
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Starting with Android 8.1.0 wrap.sh can be used to enable ASAN on Android.
Change-Id: I6ef6e5989475b9b7981d05e78a03f9680c1acb1b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Semi-automated, just needed ~20 manual fixes:
$ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} +
$ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} +
It can be easily improved (e.g. for store check that there are no commas
after the opening parens). The most common offender is QLibrary::load,
and some code using std::atomic directly.
Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Otherwise, it can happen that parsing goes on forever in cumulative
mode.
Task-number: QTCREATORBUG-17656
Change-Id: If69f2265ac7eee0d230bd77a9aa9500e97ebeff6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: Ifea720470541000481fbacc510b4cb589c9990d9
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: Ibdd3f63d9069c3f01dfe8431bcc64bde4f2aa569
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: Ifa62ad002689a0be6ed1a88ad4ac0e92082ef616
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: I2e1b42c09db88da64ec62aee7906f4c368e5bcbb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>