Calls like
QHighDpi::fromNativePixels(point, window)
would return device independent coordinates outside any
screen in cases where the window is spanning multiple
screens and the native point was not on the main screen.
Correct this by looking up the correct screen and use
its scale factor and origin when scaling coordinates.
Task-number: QTBUG-73231
Change-Id: I01a3a42f42121b8d9f4ced2bb0fb023d6ae6bfe7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Using QImage allows creating the style before the application has
been created, and is the more modern API.
No changes to the documentation needed.
Change-Id: Ifa0e5fa1113802fca18fbd45bb3c0a5ba1dbfeab
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Fix most clang warnings about override, nullptr, range-based for loops.
Change-Id: Id47e57adb63a38e2f397a31511b788a2432c97cf
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The completer popup has focus, making QShortcut direct to it's window
rather than to the window the completer belongs to. As QShortcut handles
the case for Tool windows that have a parent, but doens't do the same
for popups. And they shouldn't be treated the same way, as a context
menu popup for a e.g. text edit should in fact block the text edit's
shortcuts while open.
However, the completer popup is special, in that it explicitly makes the
widget completes for its focusProxy, which is what we can use to fix
this issue.
Change-Id: Ie7177d39668b3af14a1d9e0ee5d93eca9c67c8af
Fixes: QTBUG-4485
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Static libraries may get installed and used by other builds, which may
be done with a different version or build of the compiler. So this
commit introduces two new flags:
- no-static-ltcg: disables LTCG completely for static libraries
- fat-static-lto: forces static libraries to produce fat LTO objects
fat-static-lto is useful for Linux distributions, since installed static
libraries should not carry LTO information, but that information is
useful during Qt's own build. This feature should be used alongside some
compiler-specific method of removing the LTO information from the
static libraries prior to installation, so only the regular part
remains.
For current GCC versions, this command suffices:
strip -R '.gnu.lto*' -R '.gnu.debuglto*' libname.a
Otherwise, distributions can use "no-static-ltcg" to disable it
completely.
Change-Id: I495bc19409f348069f5bfffd155237ade9f4b42f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Codebases using QResource::isCompressed() and assuming it is Zlib break
if zstd is enabled. So change the default back to Zlib until Qt 6.0.
[ChangeLog][Important Behavior Changes] RCC's default compression
algorithm was changed back to Zlib, as it was in all previous releases
until 5.13.0. The default will remain Zlib for all Qt 5.x releases but
will change in Qt 6.0. To activate Zstd compression for your resources,
either pass the --compress-algo=zstd option to the rcc tool or add the
XML attribute compression-algorithm="zstd" to the <file> tags in the
.qrc file.
Task-number: QTBUG-76521
Change-Id: Ief874765cd7b43798de3fffd15a9f56fd9ad1ad4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Function did not handle default-constructed (null d_ptr) path correctly.
Fixes: QTBUG-76516
Change-Id: I2925d4306f7fce34ece6739b18a8e275e7970837
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
It is sufficient to run this test on systems where we don't need to
set up dependencies and satisfy other assumptions the test makes. It is
safe to assume that if this test passes on regular Unix, then
QTemporaryFile will behave as expected on Android as well.
Change-Id: Iaf9a67d7c12b3acfd0992bab591c3f906b073d9e
Fixes: QTBUG-73564
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On Android (at least in the emulator), the root file system is reported
to be of type rootfs, which we usually ignore on Linux as legacy.
Also, it's a read-only file system with bytesTotal reported as zero. We
usually ignore such volumes, but as the root file system is expected to
be in the list, we should never ignore it.
This fixes the failing QStorageInfo test.
Change-Id: I778ee9e76e385649e58d5e5ac7e0ae2d8e0ba92b
Fixes: QTBUG-73563
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
and also plain wrong comments: since we don't set verification callback
on a store - we don't have to lock (our q_X509Callback never gets called).
This change should simplify the merge with change I have in 5.12 (where
I completely got rid of locking). Since I don't care about exact errors
found (relying on the fact it's the same chain of certs we check in
SSL_connect/SSL_accept), for now we don't try to extract them from
OCSP_basic_verify. In fufure, if these chains are different, we
can create a temporary store (see how it's done in 'verify', for example)
and set a VF callback on this store.
Change-Id: I4a36e19836d19c2ea95c869dcfe85f49fe723ff0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Normal sources are built using $(CXX), which is defined in the makefile,
but can be overridden. We should do the same lazy evaluation of the
compiler for headers.
Change-Id: Ic548786bd18ed8fb7eb0b58a527615ab19000323
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This palette isn't usually used, and the platform theme's palette is
preferred, but if a client asks for the standard palette (e.g. as
used in the styles example) we should try to report a palette that
gives the system look.
Change-Id: Ie5e58c890c13c716a9e9b5093b954a737e550dee
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
With Web Engine, QQuickWidget or similar, the code can hit on the offscreen
window, when its handle is null. Add a check.
Amends 3af7b27917.
Fixes: QTBUG-76440
Change-Id: I123633d18386efd3dbfb22aad6072e4f0877a62e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
On Linux this role is needed to make desktop notifications work.
There is no equivalent for Windows, iOS or macOS. On these platforms the
role will have no effect.
Fixes: QTBUG-76333
Change-Id: I4ef3b3321f7a0e2c09c1ce432a668428d14c52b7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
m_requestedSize is already scaled by the QtGui scale
factor (e.g. as set by QT_SCALE_FACTOR). Multiplying
by QWindow::devicePixelRatio() then applies this factor
again.
Use QPlatformWindow::devicePixelRatio() instead, which
returns the platform scale factor.
Change-Id: I133e99d84f4718215fda9ef0cf81a113b51db2c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since e9e16c7464 running webengine application you can get
warning "Attribute Qt::AA_ShareOpenGLContexts must be set before
QCoreApplication is created."
WebEngine set shared open gl context on qt_call_pre_routines, so
when QCoreApplicationPrivate init() runs.
Fixes: QTBUG-76391
Change-Id: I5fc146ed70054b0c1597fe06615cea2d7a8969d8
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The window shadow rendered by AppKit is based on the shape/content of the
NSWindow surface. If the backingstore is partially transparent, we need
to invalidate the window shadow after each resize (and subsequent flush)
of the backingstore.
Change-Id: I451370af5a8c0c25faea26beb3faa2483a33a5cf
Fixes: QTBUG-74560
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Instead of using the address of a function pointer, we name-mangle window
classes by using an UUID.
This fixes a real-world problem with multiple Qt instances where for some
reasons the window function appears to be mapped to the same address.
Change-Id: Id27e8d7aa17a4db9c14559224395f49d3ecd8d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QTBUG-66380 introduced a behavior change drawing a checkable menu item
with an icon. After this path the checkmark and icon was drawn.
Revert this regression so the stylesheet style matches the behavior of
all other styles. A checkable item should have two different icons
(QIcon::On and QIcon::Off).
Fixes: QTBUG-74655
Task-number: QTBUG-66380
Change-Id: I32ac2f397087a1c3d5d07400372109703c00c1ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
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>
If the QMAKE_CXXFLAGS already had -ffat-lto-objects, the *= wouldn't add
it it again, after our "-flto -fno-fat-lto-objects", which meant the
last one would stand.
Change-Id: Ic9cfa6256b5045caa6e6fffd15a7f6cda7aaa837
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
We need one scale() function for each type: the scale factor can be
inverted by the caller for the fromNative case. Add a generic
templated implementation which will handle simple types. Add add
specialization functions for compound types that don't have
operator*(), as well as for position types (e.g. QPoint) which account
for the origin.
There's no need for fromNativePixels() and toNativePixels() overloads
for each type; replace with generic implementations which call
scale(). Do the same thing for fromNativeLocalPosition().
Some user code is calling fromNative()/toNative() directly, so leave a
definition of those functions around for now. Also leave a couple of
one-off scaling functions which do not fit the pattern.
Also fix “narrowing conversion scaleFactor to int” warning for the
QMargins scale function.
Change-Id: Ia67accbb670a80dc1747c2e264b97aab75b1251b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>