Rewrite the existing accessor QWidgetPrivate::windowHandle() to
accept a mode enumeration that has an "Any" convenience.
Based on that, add QWidgetPrivate::associatedScreen(), which is seful
in many places where scaling is performed.
Prototypically simplify the code.
Task-number: QTBUG-62094
Task-number: QTBUG-73231
Change-Id: I516288363d329bce9bc94e4951106f9357bc6cde
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It's never set anywhere, neiher in QtBase nor in any other Qt module.
So, remove.
Change-Id: If616d350a1c1c74f6f3e87f8cd98ccb3bff5cf70
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This involves replacing the use of QStringRef with QStringView and
replacing int indexes and sizes with qsizetype ones.
Since we use QStringView now, where mid() is cheap and well-defined,
remove the offset and length parameters that used to be Part ctor
arguments, and use mid() in the caller.
Change-Id: I08f3cd467b7b935f734b73d15eb8564b7deaa87e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace explicit iterator loops with ranged for loops.
Also remove the pointless detach() of the QString result, caused by
calling mutable data() instead of using the old trick of const-casting
constData().
Change-Id: Ia7e2cb2926dc30b4dba33200b17697fd33d22446
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The IPv4 overload takes a IPv4Address, which is just an quint32, so it
doesn't matter whether clients call it with a const or a mutable
argument.
The IPv6 overload, OTOH, took a IPv6Address, which is a typedef for
quint8[16]. This allows users to pass a quint16[16], but not a const
quint8[16], because that would lose the const. The function, however,
doesn't modify the argument, so it could be const.
Make it so, even though, due to the typedef, it looks like a redundant
top-level const.
Change-Id: I0506f6f9026ad616c4450fceb45fea137ac27692
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The function qGetPtrHelper() is mainly used to implement d_func() within
the Q_DECLARE_PRIVATE() macro. The whole purpose of d_func() is to
propagate const deeply. But if a smart pointer implements this by itself,
then the old version of qGetPtrHelper(), by taking the Ptr as a const-&,
would always return a const payload pointer, which would fail in the
following reinterpret_cast in d_func() to mutable payloads.
This was found while experimenting with making QExplicitlySharedDataPointer
deep const-correct, and I have no explanation why it seems to have worked
with QSharedDataPointer, which is deep-const-correct already.
Change-Id: Iee2e8fcce89c58ba2af7818de6f79ed39c5a4030
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
androidtestrunner now checks is the apk is build and if it is, it will skip the build phase.
Now we can build the apks in parallel (which takes most of the time) and run them sequentially.
This way running tests on Android is much faster.
Change-Id: I82f34723ac08f7728cc0daab3366e03821335eed
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
It is perfectly possible to accidentally create a parent/child
loop. This can happens by direct means (a->setParent(b);
b->setParent(a);), or some more subtle means, e.g.
class MyClass : public QObject {
MyClass() : QObject(this) {}
};
Since this is UB, add a few robustness checks to make sure the
code above crashes right away (at least in debug builds).
Change-Id: I6583c8514b4c1f8a90677b04c77b8e8f0c15dba3
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Now creating an .apk it's easier than ever.
"$ make apk" is all you need to run to create an apk for your application.
[ChangeLog][Android] Introduce "make apk" target, an easy way to create an apk.
Change-Id: I12565e7ed32beb42da40d8ce42a52339038be950
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Ant is history for so many years, yet we forgot to remove it from
androiddeployqt.
[ChangeLog][Android] Remove ant support from androiddeployqt
Change-Id: I093295e18e8710c565e9d101e21c49b3c62f6322
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
androidtestrunner is a tool needed to run qt tests on Android.
Now you can run tests as simple as you run them on Linux, macOS,
Windows.
"$ make check" it's all you need to run tests on the default android
device.
ANDROID_DEVICE_SERIAL env variable can be used to use a specific android
serial.
Use cases:
$ make -j1 check
-j1 is needed to make sure we don't run multiple tests in parallel.
$ ANDROID_DEVICE_SERIAL="emulator-5554" make check
Run the test on "emulator-5554"
$ make TESTARGS="-- -xml" check
Switch to xml output. All params after -- are passed to test
application.
$ make TESTARGS="-- -o out.xml,xml -o out.txt,txt -o -,tap -vs" check
Create two files out.xml and out.txt in the current folder and print
"tap" format to stdout and enable logging of every signal emission.
[ChangeLog][Android] Make it easy to run Qt tests on Android.
"$ make check" is all it's needed to run a test on an Android device.
Change-Id: I1a7f64b62608f7367b5a6aabf5d6c6e7e50242e6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
It's deprecated since e56401818b
but still needed for QWidget rendering - therefore move it to
QPainterPrivate.
Change-Id: I35880ffa22830c2921c6675b1acf7e4ca38601db
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
They were never referenced outside the classes' ctor and, worse,
remained uninitialized if the specification string contained devices.
Change-Id: I977a156acf10190428da00fe128fee70cff8f98d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
All four manager classes contained roughly the same code in their
ctors that parsed out devices from a colon-separated string.
Extract shared code, and port the parsing to QStringRef (later to be
ported to QStringView).
Saves ~2.4KiB on optimized Linux GCC 9.1 AMD64 builds across all
.so's that link to libQtInputSupport.a.
Change-Id: I3db826ee2b422cfc02f8d49bd21985a03b6c0935
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
To not write into a shared object without mutex protection. If the
stored icon name is empty, just calculate a new one on each call.
Task-number: QTBUG-45684
Change-Id: I01dfb6697b5275e69451da91fdc7346f40bc424e
Reviewed-by: David Faure <david.faure@kdab.com>
Make create() return, and m_mice/m_keyboards/etc store, handlers by unique_ptr.
In most cases, we can't use qt_make_unique(), since the ctor we're calling is
marked as private.
Since QHash can't hold move-only types, use a std::vector<{QString, unique_ptr}>
instead. As this pattern repeats in all four QEvdev*Manager classes, create a
small class template.
Saves almost 6KiB on optimized Linux AMD64 GCC 9.1 builds across all .so's that
link to QtInputSupport.a.
Change-Id: I8f62b6b629d6e1855314c0a4fb4fc069db9ae0ce
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QExplicitlySharedDataPointer is propagating const in my tree, and I will be proposing
this for inclusion into Qt 6, so proactively fix the breakage here.
QMimeType is known to be non-reentrant (QTBUG-45684), and this patch doesn't fix it.
Change-Id: If68b148c44439d76ab1d95e8db93b90d12650e51
Reviewed-by: David Faure <david.faure@kdab.com>
It's needed to prepare qtdeclarative for the upcoming patch that
won't make QGradient accept illegal presets any more.
Change-Id: I4ca929e75214ebe24c7d762d0c37ca254c640c57
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... and replace them by C++11 range-for loops.
Change-Id: I6975121f606ec1fcda7a624b02a68edf829bb70b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
The code is noisy and repeats, so wrap it in a function.
Change-Id: I5e6e924e22b0bc631eb8176de96c49066b1c9029
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Dealing with 'tokens' is straight-forward.
With 'literals', it is not quite so straight-forward, because the
ownership chain here is two levels deep. But it's still worthwhile,
because it replaces quite error-prone code with code which may be a
bit more verbose, but is totally safe.
As a drive-by, moved initialization of the fromEnvironment member to
the body of the ctor in order to avoid code-churn (I needed to touch
the ctor-init-list anyway).
The QMessagePattern dtor is now empty and consequently defaulted.
Change-Id: Iadb25e7aba1c5a94fd9068be7ae03f17e975328b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Wait for the result at the target index if the future
is running and the iterator index is past the current
result count.
Determine if there is a result at the target index
after waitForResult() returns, and return -1/end if
not.
Also support decrementing the end iterator. In this
case wait for the future to finish in order to get
the final result count.
Task-number: QTBUG-59811
Change-Id: I8fcc711bab2e72c3c5196a55b794d25e18bb324d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
- Use range-based for
- Use isEmpty() instead .size(), streamline code
- Fix warnings about class definitions, use Q_DISABLE_COPY_MOVE
and '= default' for trivial constructors
Change-Id: I76255fd9d80c3faffebda9a438e86e918c16d289
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Fix warning like:
warning: use auto when initializing with new/reinterpret_cast to avoid duplicating the type name [modernize-use-auto]
Change-Id: Ieb7f052919173f6923e68de9f9e849dee45e36e7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The Vulkan backend of QRhi relies on vk_mem_alloc.h from AMD in order
to get a stable, performant, and tested GPU memory allocator. It is not
unthinkable that we will move away from this in the future, especially
considering that a potential future D3D12 backend may need a similar
solution, but until then this will do.
Change-Id: I198a898f216d0795b4bf339ccea80b0cd2efbabc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Comes with backends for Vulkan, Metal, Direct3D 11.1, and OpenGL (ES).
All APIs are private for now.
Shader conditioning (i.e. generating a QRhiShader in memory or on disk
from some shader source code) is done via the tools and APIs provided
by qt-labs/qtshadertools.
The OpenGL support follows the cross-platform tradition of requiring
ES 2.0 only, while optionally using some (ES) 3.x features. It can
operate in core profile contexts as well.
Task-number: QTBUG-70287
Change-Id: I246f2e36d562e404012c05db2aa72487108aa7cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If the mouse button is held and mouse moves from over the window, that
window would never register the button up event, and cause issue like
being able to move a dialog around by simply moving the mouse around.
Change-Id: I1363ac9c9f4113a79bf6863668ba74b90b1cea4a
Fixes: QTBUG-75951
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The declaration of tr() in the Q_OBJECT macro interferes with the
tr() declaration in the QObject class. This update fixes that bug
by resetting QT_TR_FUNCTIONS to be empty and by ensuring that the
tr() declaration in class QObject is seen by clang when qdoc is
running.
Change-Id: If55339fc417f3eee1a1e1ce3df75a18af443d630
Task-number: QTBUG-75864
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The problem becomes visible with styled native text materials in Quick,
but only in certain cases: the regions not used by glyphs in the QImage
are undefined (if they are 0 there's no problem) - but the whole
code path is only used when the fbo readback workaround is enabled.
When these conditions met, the styled text materials may sample locations
with uninitialized data in the texture, showing small artifacts around
the glyphs when shifting is involved in the styling.
The non-image based GL glyph cache handles this by an explicit upload
with all 0's when creating the texture - the QImage code path should do
the same then.
Change-Id: I818ee19f87c6a147e42cd3ead39645da4d0fef11
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
[ChangeLog][qmake] Introduced the variables LEX_DIR and YACC_DIR which
determine the location of lex/yacc output. Fixed parallel execution of
lex/yacc for debug_and_release builds.
Fixes: QTBUG-65730
Change-Id: I68c8260a95609e11bb5205a91aff2c098ed7009c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Elements that appear in QMAKE_DIR_REPLACE_SANE must appear in
QMAKE_DIR_REPLACE to be considered due to the algorithm used in
exclusive_builds_post.prf.
Change-Id: Ibce7e6c988b3e8a141075890a2f547eb34090b3a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
... except where they are actually the component under test.
Java-style iterators are scheduled for deprecation.
Change-Id: If4399f7f74c5ffc0f7e65205e422edfa1d908ee8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
also fix data progress
Task-number: QTBUG-75489
Change-Id: I5222fda64d258a6ae78ba0ca20194b81c289c27e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
They are going to be deprecated.
Add a strategic break. This was a pre-existing problem: the comment
claims that h is invalid (though I personally don't see it), but
then goes on to check the loop condition (which, in the mutable
Java iterator case, involves calling h.cend()). We now cache the
end iterator, so if there ever was a problem, it's probably a
lesser one now, but it's still not kosher, and a debug version of
QHash would find it, so break out explicitly.
Saves ~200b in text size on optimized GCC 9.1 Linux AMD64 builds,
ie. ~100b per loop.
Change-Id: I7684485b55fb23a8cf882f89621ebb75a0e607b5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This requires making QDebugStateSaver hold QDebug::Stream directly, not
QDebug by reference, as the referenced object will have been moved from
when ~QDebugStateSaver executes. The stream object, however, will still
be around.
Change-Id: I0ca2eb60cb9b68ea3835d9a9ff5e295d9b1c5fb5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
QSaveFile should preferably be used by editor applications to catch
write errors.
Task-number: QTBUG-60635
Change-Id: Ia609435871b56b45714c3dd3d32bbc85b5cb4dd5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Also use qUtf16Printable() and qErrnoWarning (removing explicit errno, where
present).
Saves 6.6KiB in text size on optimized Linux AMD64 GCC 9.1 build across
all .so's that link to QtInputSupport.a.
Change-Id: I1def2cfabd2eed65390099cd1d06f8061a9355be
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The only reason the code used QSharedPointer is that it used QVector
to hold a collection of them, and QVector infamously cannot hold
move-only types such as std::unique_ptr.
Fix by using std::vector<std::unique_ptr> instead. Also, pass the
objeccts into non-sink functions by raw pointer instead of shared_ptr.
As a drive-by, replace clear-following-iterate by the for-exchanged
pattern.
Change-Id: I605fbb98af840c1b93eab9e65c07defd6e7b39e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Extracted from the SVG names patch.
It basically just requires adding a constexpr constructor to the
inner union, then sprinkling constexpr on the existing ones.
Do minor refactorings as drive-by.
Change-Id: I60e7a1c9068def3507cb07440450e51673269f84
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>