The situation when qGuiApp is null is possible, for example, during
static palette setup. This is also a bon ton to check pointers before
dereferencing them.
Task-number: QTBUG-71186
Change-Id: I8021cef073eedaa0e4c2eb621890e73e8126175c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
After commit 5f160a3699 moved the code
that's shared across all bearer management plugins into QtNetwork, there
is one piece of code remaining that's shared across the connman and the
networkmanager bearer plugin: The dbus ofono interface code. To avoid
linking that twice (and causing duplicate symbol errors), this patch
moves it into a static platform support library. This way for shared
builds the code is included twice, but for static builds only once.
Change-Id: Idf5414bc22fea45f11c600f28eaea91bb4dc6308
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
stat() and friends expect a null-terminated C string. There is no way to
generate anything useful from a string that has null bytes in the
middle. It's important to catch this early, as otherwise, for example, a
QDir::exists() on such a path can return true, as the path is silently
truncated.
Extend the checks for empty file names to windows and add checks for null
bytes.
Change-Id: Ie9794c3a7c4fd57f9a66bdbbab8b45a08b6f9170
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Apple software renderer is perfectly capable of being used when
compositing CA layers.
Change-Id: I3b78ff61a79869ecdb7bd431388041f2c124472e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Some clients such as QOpenGLWidget will end up drawing and flushing
during the resize event, which for GL will result in an immediate update
on the screen. The problem is that the underlying Core Animation layer,
and the window's frame, has not been visually updated yet to the new
size, so we end up drawing "ahead" of what the window server is showing
the user.
Ideally we'd be able to present the GL drawing in a transaction, in sync
with the drawing of the window frame, but this API is only available for
CAMetalLayer and CAEAGLLayer.
As a workaround we detect when the exposed size is out of sync with the
window geometry, and skip the flush until the exposed size has caught
up. We know this will happen eventually as AppKit will always ask us
to display after a resize.
Change-Id: I1739ac8878b3fc6820a55dd017ddd170fd5f55d6
Fixes: QTBUG-79139
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
We were disabling wantsBestResolutionOpenGLSurface whenever we detected
the Apple software renderer, but this isn't needed when layer-backed,
and did in fact result in the exact same visual result as the bug the
code was working around -- only rendering to a quarter of the viewport.
We now apply the workaround only when software rendering is combined
with surface-backed views.
The logic has also been improved to not rely on string comparison to
look for the software renderer, but instead uses the renderer ID that
the context provides.
Since tweaking the wantsBestResolutionOpenGLSurface is only relevant
when using a window for GL rendering the logic has been moved into
QCocoaGLContext.
Change-Id: I021aaefbb7a9782bc8ee3c9703da246510326d50
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This flag is needed by LLDB & simple perf tools to locate the right binary.
Change-Id: Iffa1b0678663cfb9d1d699da5ad6fe672863918c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Make it readable by using names instead of mere indices for the stages.
There is an important fix in there as well: when in a render pass, only
resource for VERTEX and FRAGMENT are taken into account, while in a compute
pass those are skipped. This ensures that we do not send messages to a nil or
invalid MTLRender/ComputeCommandEncoder. (nil would not be an error but the
other is fatal)
Task-number: QTBUG-79447
Change-Id: Ibef108cb7c82b5b0fdd2a299cd89fbebe8c3606a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
...when available. Fall back to the QRhi (i.e. SPIR-V) binding
point otherwise (which becomes unsafe once shadertools bumps
its SPIRV-Cross snapshot, but is fine for existing .qsb files)
Task-number: QTBUG-79368
Change-Id: I2d452fdd4efb484867732c358171a800d3261dcd
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The deserializer remains compatible with .qsb files without this
additional section.
Task-number: QTBUG-79368
Change-Id: I03e2a634febbd88da7f6a4369f104855ea31e3af
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
We don't want the metatypes to be generated into the file system root in
that case.
Change-Id: I91bab20fa498de0f2918d8ee5b2f230cc0610aae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
During the creation of a raster paint engine in QImage::paintEngine(),
the QImage will be detached. At least old gcc versions would get
confused so that the newly created paintengine would end up in the old
QImage copy insteads of the newly detached one. Work around by
dropping the temporary engine pointer.
Fixes: QTBUG-79383
Change-Id: I27b1f24312269bc2bcc641dc4334397a92e3bfbb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The default implementation used the locale, the reimplementation
supported translating the texts. This mixing of l10n and i18n concepts
resulted in bugs and inconsistencies.
Using the texts for AM/PM from the locale that is set on the date/time
control is sufficient.
[ChangeLog][QtWidgets][QDateTimeParser] AM/PM strings in QDateTimeEdit
and other classes using QDateTimeParser are provided by the locale, and
are no longer translatable.
Change-Id: I83a5dab470ae5ba35b3ce4040ad1877908f462c7
Fixes: QTBUG-75866
Task-number: QTBUG-72833
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
In turn, deprecate the QJsonDocument methods that deal with JSON binary
data. You should use CBOR for data serialization these days.
[ChangeLog][Deprecation Notice] The binary JSON representation is
deprecated. The CBOR format should be used instead.
Fixes: QTBUG-47629
Change-Id: Ic8b92ea36de87815b12307a9d8b1095f07166db8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Windows API MemoryBarrier function is actually a macro when
_M_ARM64 is defined and it conflicts with the MemoryBarrier method when
it's declared and used.
Task-number: QTBUG-77388
Change-Id: I762edfc4ca1a44cbe095724de708c7cdad34ae65
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
It tells us how many bytes we will need before the call succeeds. It's
not accurate but will reduce the amount of calls to their slow functions
Change-Id: I82393d5acd68b84c6e6f3377ba40bb1d5c51ca8a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This moves some repeated code into functions (namely readToBuffer and
retainExtraData) while also changing how the intermediateBuffer is
handled to avoid deallocating and reallocating repeatedly.
Change-Id: I49e6cee641f961565051a67123c56b1c8f3c0259
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
If c++17 is available and the header is available (not
experimental/filesystem) then we'll try
std::filesystem::recursive_directory_iterator as well.
Results on my PC (Windows, VS 2019):
PASS : tst_qdiriterator::posix(C:\depot\qt\main/src/corelib)
RESULT : tst_qdiriterator::posix():"C:\depot\qt\main/src/corelib":
23 msecs per iteration (total: 94, iterations: 4)
PASS : tst_qdiriterator::diriterator(C:\depot\qt\main/src/corelib)
RESULT : tst_qdiriterator::diriterator():"C:\depot\qt\main/src/corelib":
17 msecs per iteration (total: 71, iterations: 4)
PASS : tst_qdiriterator::stdRecursiveDirectoryIterator(C:\depot\qt\main/src/corelib)
RESULT : tst_qdiriterator::stdRecursiveDirectoryIterator():"C:\depot\qt\main/src/corelib":
6.7 msecs per iteration (total: 54, iterations: 8)
PASS : tst_qdiriterator::fsiterator(C:\depot\qt\main/src/corelib)
RESULT : tst_qdiriterator::fsiterator():"C:\depot\qt\main/src/corelib":
23 msecs per iteration (total: 92, iterations: 4)
And as a drive-by fix: move the 'data' function out of the private slots
so it is not invoked as a test function (it doesn't cause any problems
but is ultimately pointless).
Change-Id: Ia160ee276423ec51e35e554a4cd63d4d940c0e6a
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: I74ca824d5a2ee6c295c41cd577eab466326395f0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: I9eae3291bc6934375404224c7242e2b23af2019b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This is part of the migration of qtbase from QRexExp to
QRegularExpression.
Task-number: QTBUG-72587
Change-Id: I47a047e27432c874b47bd25581806e1bc156e94f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Fix a typo introduced in be56db2c49 to
avoid a crash when a pixmap is given for selected on but not for
selected off.
Fixes: QTBUG-79125
Change-Id: I84072b6b4e8a4d21684be21f5bff1deeaddbba6d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Inspired by a recent Qt Quick fix. Make sure we make it
clear that QRhi-based rendering code should base output
size calculations (e.g. for setViewport() and similar)
on the pixel size reported from QRhiSwapChain, instead
of going to the QWindow.
Change-Id: I2fc22972162ccc6307ac07ceb7766c746d5f562a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Clarify that the qproperty properties will only be
evaluated once.
Fixes: QTBUG-2982
Change-Id: Ie294ced118f740c7378c62c0b5a4924d5628e118
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
This partially reverts commit 5e8b16f0e4.
Releasing the mouse button synthetically made it impossible
to use tap and hold gestures. When investigating, it seems
that other changes have fixed the original issue that
5e8b16f0e4 was meant to address,
so this is no longer needed.
[ChangeLog][Android] Fixed regression that made it impossible for an
application to use the tap-and-hold gesture.
Fixes: QTBUG-72408
Change-Id: I53f687d047a4ad0fdf3c8c96a00ed1b11d09f047
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
The default font on Windows ("Times" is not found) does not have
a ligature for "fi", so the test would not actually be testing
what it was supposed to on this platform, and would pass even
when the code was buggy.
To enable the test on Windows, we select a standard font which
has the ligature (Calibri).
Change-Id: Ic117cd8e549aa729a0cd68006d7c180c6c89c053
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The original commit message says this is to ensure compatibility
with the old Harfbuzz, but since OpenType features such as
kerning are often matched based on the writing system of the glyphs,
it will break kerning (and other OpenType features) for text in these
languages in some fonts. Even font that were successfully kerned by
the old Harfbuzz are broken.
To avoid regressing on finding cursor positions inside ligatures,
we need to amend 9f837af945. This
would enable cursor positions inside ligatures for languages
where they are only used for cosmetic purposes, and this was
generalized to Common and Greek at the time. This now has to be
expanded to include all the writing systems that were previously
covered by "Common".
[ChangeLog][Text] Fixed kerning error with certain fonts.
Fixes: QTBUG-77908
Change-Id: Id261fef05f86841b1533b7d87207c3d17e01e96e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Starting with JDK 12, javac no longer supports source and target
version 6. This commit changes the source and target version to 7.
[ChangeLog][General]
Fixes: QTBUG-79094
Change-Id: Ife8966db01c68251de2fe85307de30c31e658172
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This is, depending on the implementation of pthread, significantly
cheaper than using a pthread library call.
Even if we don't know the assembler for an architecture, taking
the address of the thread_local variable is still faster.
As QThread::currentThreadId() is documented to be used internally
and not meant for application code, we don't have to care about
what exact value we return. Internally, we use it only to compare
thread IDs for equality, which this implementation is sufficient
for, even if a thread ID is re-used when one of the threads
terminate and a new thread starts (since the other thread is still
executing code). Besides, pthread_self documents [0] that a thread
ID may be reused, and that the returned pthread_t cannot be
portably compared using operator==(); using pthread_equal would
require adding a Qt thread-ID type that implements this correctly,
and would make things even slower.
[0] http://man7.org/linux/man-pages/man3/pthread_self.3.html
Change-Id: Id08e79b9b9c88976561f7cd36c66d43771fc4f24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
'macOS' appears in the documentation frequently, and because it
resembles a variable/property name, QDoc links each occurrence
of it.
'WebChannel' appears as part of a module name, but it's also
a QML type - auto-linking each word to QML documentation is
confusing.
Likewise, there's no need to link 'OpenGL' each time.
Explicit links such as \l [QML] WebChannel continue to work.
Task-number: QTBUG-79135
Change-Id: I76cc84b0076255e260aa88c244102702a48f35a6
Reviewed-by: Martin Smith <martin.smith@qt.io>
Instead of having each platform plugin deal with application termination
in their own weird ways, we now have a QPA API to signal that the system
requested the application to terminate.
On the QGuiApplication side this results in a Quit event being sent to
the application, which triggers the default behavior of closing all app
windows, and then finally calling QCoreApplication::quit().
The quit event replaces the misuse of a close event being sent to the
application. Close events are documented as being sent to windows.
The close events that are sent to individual windows as part of the
quit process can be ignored. This will skip the final quit() of
the application, and also inform the platform that the quit was
not accepted, in case that should be propagated further.
In the future the logic for closing windows should be unified
between the various approaches in closeAllWindows, shouldQuit,
and friends.
Change-Id: I0ed7f1c0d3f0bf1a755e1dd4066e1575fc3a28e1
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The logic for handling termination without any event loops has been
moved up as an early exit, and the code has been modernized.
Change-Id: I202720b9923e35732cffea656e1ce108ef11953d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The logic for preventing application termination when there are modal
windows active was a leftover from the Carbon to Cocoa port, and is no
longer needed. AppKit will deal with this on its own, by checking the
preventsApplicationTerminationWhenModal property of each NSWindow.
In some cases AppKit will also ignore this property, such as when
quitting the application from the menu entry, which means we now get
the default system behavior for this use-case.
Change-Id: Iac5d8d8e17eb0974448f7ee6f39c9b7761bf4d90
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Either by testing for platform name or window activation.
After this gets in, we can enable widget tests in the Wayland bot, which
hopefully will reduce the number of regressions in the Wayland plugin.
Fixes: QTBUG-62188
Change-Id: I71ce8abd6b5891e5b953126b1c35345892585931
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This avoids error prone manual mappings when having to persist such values,
as eg. done in https://cgit.kde.org/kio.git/tree/src/kssld/kssld.cpp#n49.
Change-Id: Ib279c116a10ce8edc0b686b8b80cbd848b4b410e
Reviewed-by: David Faure <david.faure@kdab.com>
There are two places where we are only interested in the mapping of
proxy to source sort column, rather than the full mapping. Creating the
full mapping is rather expensive as it iterates all rows and columns and
allocates a large number of objects. Just figuring out the n-th accepted
column can be much cheaper.
Fixes: QTBUG-41659
Change-Id: I7ea914cb695518b4d47cdc3ad67c7786380d8709
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
For some scalings, setClipRect(QRect) would produce a clip one pixel
different from setClipRect(QRectF) because of different
rounding. Ditto for setClipRegion. Fix by making sure to transform
QRectFs instead of QRects.
Fixes: QTBUG-78962
Fixes: QTBUG-78963
Change-Id: I0be721133858c30769ec6d81e978962a3d6b70cf
Reviewed-by: Christoph Cullmann <cullmann@kde.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>