In this case we can safely return the same QSize which we accept since
it is already contains the right size for the given menu and this size
will be bounded to screen geometry before QMenu will be displayed
anyway. We also get rid of one dependency on HITheme.
Change-Id: I7502a96d180fc4a41ce3dfabe8a200b886016348
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
AİİA.pdf takes 8 QChars, but after lowercasing it takes 10, so the code cannot
assume the length to be the same.
Task-number: QTBUG-58822
Change-Id: Id6fbb99f6afd08ee420099cd66372732d7598d9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QLineEdit, QAbstractSpinBox and QComboBox did not notify micro focus
changes to the input context.
In particular, the updates were missed during pre-edit stage.
This change adds the missing bindings to QWidget::updateMicroFocus().
Change-Id: I9a7fff962f46dbabd8fb02836c206bace115793b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Change-Id: Ibd71c1ed653769637aa176dfb52c4594141be8ce
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
An Acquire barrier in QReadWriteLocker::unlock was missing to synchronize
with the testAndSetOrdered on d_ptr in the lock functions.
The race is between the write of d->writerCount in tryLockForWrite,
and the read in unlock. The acquire on d->mutex is not enough because
it is not on the same object. While that race could be fixed by taking
the newly-allocate()ed d's mutex before publishing it with testAndSet,
there's another race, on 'recursive', between a newly-minted Private*
with recursive == false in tryLockForWrite(), and the read of 'recursive'
in unlock().
Task-number: QTBUG-58917
Change-Id: I10ba36573c0e57468d11e9b77d85045711feaea1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
see 5a1b4832a2 for more detail
Task-number: QTBUG-58142
Change-Id: I51851ea9b4fe7b8eeadc452bc3dbb1ea00026d29
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Similar to support for the other Genius tablets.
https://bugs.kde.org/show_bug.cgi?id=359642
Task-number: QTBUG-52626
Change-Id: I3e2033d547d8bab4b6fb93be3a172bdce4fc5666
Reviewed-by: Dmitry Kazakov <dimula73@gmail.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The _next variable need the acquire and release fence in next()
to synchronize with the equivalent operations in release() (which
already have the them)
The ordering on the _v[block] is not enough as this does not
synchronize the same object.
Task-number: QTBUG-58917
Change-Id: I17cc39e6791433348b6227363dbea92bcf03700d
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It was introduced by 0719142321
(macOS QML fix) for apparently historical reasons and has been found to
cause various problems:
- Flicker when using QGLWidget in a QSplitter
- (obscure) crashes due to flushing out input events in setVisible().
Task-number: QTBUG-38327
Task-number: QTBUG-39842
Change-Id: I18081da5f4645271774a51f1d6a88e778adbd6ac
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Like the lvalue QVector::append() overload, when we reallocate,
we need to take a copy of the function's argument because the
reference will get stale upon reallocation.
Add a test.
[ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving
appending an item already in the container to the container
again.
Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In QCocoaDrag::dragPixmap, it treats QDrag::source as a QWindow, but it
is not - it's just a generic QObject* of some kind (which QQuickDrag
sets to the originating QQuickItem, and the widgets stack sets to a
QWidget). This failure means that dpr stayed at 1.0.
Unfortunately it’s not possible to receive a pointer on QWindow directly
from QQuickItem because QtWidgets and QtQuick do not share the sources,
but we can use the same dpr as current focused window has because drag
can only start from active window - press on a window which is not
focused should activate it first.
Task-number: QTBUG-57942
Change-Id: Id358c181d03d519188caaa83fb4226033b8ed1ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Allows the block in recreateWindowIfNeeded() that calls createNSWindow()
to focus on how to (re)parent windows/views, while createNSWindow() takes
care of how to set up the window. Dynamic properties that may change later
on are handled in e.g. setWindowFlags().
Change-Id: Ice0e44d004bd2608b2b54e6dde0f404a1e07dc10
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Automount filesystems like /home on many operating systems (QNX and
OpenIndiana, at least) don't like if you try to mkdir in them, even if
the file path already exists. OpenIndiana even gives you an ENOSYS
error.
So instead, let's try to mkdir our target, if we fail because of ENOENT,
we try to create the parent, then try again.
Task-number: QTBUG-58390
Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: David Faure <david.faure@kdab.com>
When the flag is not set, custom background colors for QLineEdit
will not work. Set the flag as does QWindowsXpStyle.
Task-number: QTBUG-57862
Change-Id: I6e653c2cdc8cc523673e1629bf42f833c8504431
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.
When using aggregate initialization, the guard disappears.
Amends 04d6495bf7.
Change-Id: Id9335cffdd43094cafb231fdde2523d013abe1d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QNetworkSession's ctor has a race condition: it 1) connects signals/slots
and also 2) registers meta-types (but after these connects). Our users apparently
have a lot of per-thread QNAMs in multiple threads (and implicitly
many QNetworkSessions on different threads too). From error logs it appears
that while one thread tries to connect signals/slots and evaluates the types
of signal and slot arguments, another thread can register this type.
If the first thread extracted signal argument types, then the second
registered this type, we can end up in a 'type mismatch' error on the first
thread with seemingly the same types in a debug message (something like
"type mismatch A::Some <-> A::Some") - they have the same name, but one
has type() == 0 and another - some non-zero type().
Now we call qRegisterMetaType before connect.
Task-number: QTBUG-50901
Change-Id: Idbb9515573e174bbc5e5bf55dc3a7911a81646ea
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Dock widgets with custom titlebar are frameless by default, so this
isn't usually a problem. However, the user can override the default and
make it non-frameless (by just removing the native title bar, not the frame).
Task-number: QTBUG-58843
Change-Id: Iff7a2a719cb2f326f2f81bbfb1b53ba01a63f3e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
That's what the MSDN documentation say one should do in the handler
for WM_DPICHANGED
[ChangeLog][QtGui][Windows] Windows are now automatically resized
when they are moved on a screen to adapt to the new pixel ratio.
Task-number: QTBUG-55510
Task-number: QTBUG-48242
Change-Id: I7688f12165f76585d75686e2e94b0fc562627be2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QDesktopWidget only needs a QWindow to access its screen, and has no use
for the platform window. To keep old code working that may have called
winId() on the QDekstopWidget we still ensure it gets created lazily,
even if that will just create hidden fake windows on many platforms.
Change-Id: I2d05b96dfeebeaf3f1278cfef6301ef4cb855a57
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The library feature already covers this. As library depends on the
dlopen compile check, we can assume dlopen to be available, also on
vxworks.
Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The subpixel RGB alpha values were not converted from host endian to RGBA
order before being used as RGBA ordered.
Task-number: QTBUG-58619
Change-Id: I18e1c9df902c7e9001a0e511f06fc953dd7afa3e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Extends the short-cut of not fetching destination to also apply to
the RGB64 painting. This saves reading and converting destination pixels
when they will be fully replaced with source pixels.
Since ARGB32 was switched to using the RGB64 drawhelpers, and ARGB32 is
particularly expensive to read, this change is important to avoid
performance regression.
Change-Id: If3a2439140d6364e8429783cfa786bd000cfab45
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
It is never written after initialization, and accessed concurrently
outside mutex protection, so make sure that it never changes by
marking it as const.
Change-Id: Ib28b2e8b3067d596a95d1699165a6ebfb15fe674
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Instead of relying on specific notifications to change the window
state we now evaluate the state based on the current window state.
This allows us to get rid of windowShouldZoom in the window delegate,
making window state handling work for foreign windows as well, and
also allows us to re-evaluate the state in more places, such as
when moving a window, which may bring it out of maximized state.
The full screen state is tracked by a helper category that doesn't
just rely on the styleFlag, but also on the full screen notifications.
This is needed as macOS will complain if you try to go in or out of
fullscreen while a transition is in effect.
The differentiation between performFoo: and foo: has been removed,
as the latter works in both cases and doesn't rely on the button
being visible/enabled.
These changes fixes many observed quirks in the window state handling
that also resulted in making it hard to write tests that relied on
the fullscreen/maximized operations always working.
Change-Id: I0538c42d9223a56f20ec9156f4939288e0750552
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Adding 0 each time will obviously not produce a new identifier each
time...
Also use static initialization for QBasicAtomicInt.
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.
When using aggregate initialization, the guard disappears.
Amends 265db5ad9b.
Change-Id: Ia71290cf26c486dcbcc74381f12cd0c4712d6019
Reviewed-by: David Faure <david.faure@kdab.com>
Use F16C or ARM FP16 if available at compile time.
Configure check added because older clang compilers have F16C defines
and flags but not all the intrinsics.
Change-Id: I71f358b8fd003e70ab8fcf35097414591e485112
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use of XInput 2 may result in regressions. For example we call
XISelectEvents for each window every time a device plugs/unplugs.
It causes significant delays when there are many native windows.
Change-Id: I60b799bb667d0e4bca1f9c52cdaa07b04bcc749f
Task-number: QTBUG-57013
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to emit
the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false-negative
dynamic_cast and catch evaluation.
Since the classes are already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need to
avoid adding code to the out-of-line destructor until Qt 6.
While at it, de-inline also the empty default implementations of
virtual (non-dtor) functions.
Task-number: QTBUG-45582
Change-Id: I3e6f37eab1dee0db445f6c13638a43ca3bf6ac62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt::Desktop exists to support QDesktopWidget, which predates the QScreen
API. QWidget internally has checks that prevents you from reparenting a
QWidget into a QDesktopWidget, so we should have the same limitations on
the QWindow level. This allows platform plugins to implement Qt::Desktop
as simple (possibly shared) wrappers around QScreen without having to
allocate native window resources for each desktop window.
Change-Id: Ia1bac506febd3d827a6e0b8ad3bfd95be0cc7f9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
We require lambda support in the compiler since Qt 5.7, so drop
the guard macro.
Apart from MSVC 2013, all our supported compiler also support
char16_t:
- VxWorks uses GCC 4.8, which supports char16_t since 4.5.
- ICC supports char16_t since v12.1; we require v14+.
- ONX uses a GCC which supports char16_t in the compiler,
but is equipped with a stdlib that does not sport char16_t
support, which is why we revoke its Q_C_UNICODE_STRINGS in
qcompilerdetection.h. But we don't need stdlib support, we
only need the core language feature.
This is the only platform where this patch actually changes
something. It removes the, rather unfair, pessimization of
the platform which could have supported the static-storage-
duration implementation of QStringLiteral instead of the
fallback, which uses dynamic memory (QString::fromUtf8()).
- GCC and Clang support char16_t since 4.5 and 3.0, resp.,
which is far below our minimum compiler requirements in
effect since Qt 5.7.
- On Windows, MSVC supports char16_t since 2015 only, and we
still support 2013, but on Windows, wchar_t is the same size
as char16_t, so instead of u"str" we can fall back to L"str".
So simplify the implementation of QStringLiteral by assuming
that all these feature are present, adding noexcept to the
lambda to make noexcept() queries return true.
This allows us to guarantee:
[ChangeLog][QtCore] QStringLiteral is now guaranteed to be
evaluated at compile-time. The last platform (QNX) to use the
QString::fromUtf8() fallback has been ported to allocate the
string data statically, too.
Change-Id: I7920d7a77001e5c5550e7c7d57ceb7c51c9eb443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A variable of static storage duration that is not zero-initialized
takes up space in the DATA segment of the executable. By making the
counters start at zero and adding the initial value afterwards, we
move them over to the BSS segment, which does not take up space in
the executable.
Wrap atomics used across function boundaries into small functions,
to avoid code duplication and to increase readability.
Change-Id: Ida6ed316ecb8fe20da62a9577161349e14de5aed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Systematic testing in tst_QStringApiSymmetry revealed a bug in
QStringRef::toLatin1(): a null input did not result in a null output,
but an empty one. This is fixed, for consistency with
QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved
correctly already.
The same bug was found in QString(Ref)::toLocal8Bit(), which is
particularly hideous, as it's documented to fall back to toLatin1(),
which preserves null inputs. Fixed, too.
[ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of
the input QString (outputs null QByteArray).
[ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now
preserve nullness of the input QStringRef (output null QByteArrays).
Change-Id: I7026211922c287e03d07e89edbad2987aa646e51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QDeadlineTimer will eventually support CLOCK_MONOTONIC_COARSE on Linux,
so let's be safe before that change appears.
Change-Id: I9b423f1b71194205b27afffd14a383a7e9f66a9d
Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
3e9db01a2e4be5034d10d6eeafd65d0a8609615b entered dev after the 5.8
branch.
Change-Id: I4139d5f93dcb4b429ae9fffd14a349e85e62a298
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It was unnecessary, since we only cached the static types, which are all
generated by the macro anyway. The way it was implemented, this produced
data races that are strictly-speaking UB, even if all the threads were
writing the same values to the same data locations.
This commit changes a little the code to simplify, since we're changing
those lines anyway.
Task-number: QTBUG-58851
Change-Id: Idc5061f7145940f987dffffd14a30047846e3113
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The button in the title bar is used both for going into full screen and
maximizing (zooming) the window. We can't hide/disable it unless both
Qt::WindowFullscreenButtonHint and Qt::WindowMaximizeButtonHint are
off.
This means that when Qt::WindowMaximizeButtonHint is off, it's still
going to be possible to Option-click the button to maximize the
window, but this is less of a concern than hiding the full screen
button when Qt::WindowFullscreenButtonHint is set.
Change-Id: I70dbe27b3197fe22c1781277f8bf9a818d71d04d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Update the flightinfo example to use the new QRegularExpression class
in place of the deprecated QRegExp.
Change-Id: I2395b37170565e922500e675210c400e90ae0f73
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Update the legacy grabber example to use the new QRegularExpression
class in place of the deprecated QRegExp.
Change-Id: I1d1871b7e82cdb214fdd8ad55a606d5e7682fab1
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Update the arthur code sample to use the new QRegularExpression class
in place of the deprecated QRegExp.
Change-Id: Ic7efd4466b4c0fa50170b80ebb22fcb3624399ce
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Update the codecs example to use the new QRegularExpression class in
place of the deprecated QRegExp.
Change-Id: Ibd60b7256071f8166c4bf38e6a40935494c3cf3f
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Update the settingseditor example to use the new QRegularExpression
class in place of the deprecated QRegExp.
Change-Id: I07e34bf916bdde161c4253fca70b853061cd589b
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>