Running the test case leads to multiple calls to show the software
keyboard, which due to Android QPA implementation leads to the
keyboard being shown during subsequent test cases, leading to
random failures. Skip it temporarily on Android until the
Android QPA implementation is fixed.
Task-number: QTBUG-119574
Change-Id: I29f234fe08cb33358cb5cb0f8e51b1cc0f8e8906
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
grabWindow() currently returns a null QPixmap on Android due to even
raster windows being backed up by OpenGL/QRhi. The test case uses
grabWindow() internally to grab contents to a pixmap and comparing
whether the pixmap contents are as expected, leading now to failures
due to null QPixmap being returned.
Task-number: QTBUG-118849
Change-Id: I51cda2d43fe482252d5604f6b18281d810aa4d2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Refactored platform windows on Android so that all window
types, including raster windows, have their own surface to
draw on.
Raster windows now flush the backing-store via RHI/OpenGL.
As a drive by, update to newer JNI syntax where appropriate.
Task-number: QTBUG-116187
Change-Id: I3b764b7126abf53556750b0ccbb7d27efe007bc1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If a QPA-provided engine provides an "edit-cut" icon, then it won't be
null. We cannot reliably test that the icon came from the fallback theme
as the cacheKey of the icon doesn't change (the proxying to a different
theme is handled internally by the QThemeIconEngine).
That the cacheKey of a QIcon doesn't change even if the pixmaps we get
from it change is not a problem in practice; QIcon is a named container
for transient graphical assets that might change for reasons outside of
Qt's control (such as color scheme, or display resolution).
Change-Id: I695e8ad0c8f0aec7f17a2c242e64b615178b78b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The previous attempt to fix this bug did not work out well since it
tried too hard to avoid double calculations. Therefore restore the old
behavior and fix makeVisible() instead.
This amends 1082038bd8
Pick-to: 6.6 6.5
Fixes: QTBUG-119366
Change-Id: I738a3cd3537ecf0983480d2f961f45f81d101bd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When a type was explicitly made non-copyable and non-movable, refuse
attempts to mark it as relocatable.
Trivial relocatability is an optimization for move+destroy, so we
shouldn't allow working around the class author's wish to have a
non-movable type by a user making it Q_RELOCATABLE_TYPE.
Therefore, add a static_assert() to Q_DECLARE_TYPEINFO that fires
when a non-copy/move-constructible type is made Q_RELOCATABLE_TYPE.
Also add a similar static assertion to QTypeInfoMerger: All members
of a class T may be Q_RELOCATABLE_TYPE. But that doesn't mean that
T itself is:
class T {
QString m_s;
QByteArray m_b;
Q_DISABLE_COPY(T)
public:
~~~~
};
so check that T is actually copyable (or movable) when QTypeInfoMerger
would have have yielded isRelocatable.
Since Q_DECLARE_TYPEINFO and QTypeInfoMerger are not the only ways in
which a user can mark a type as relocatable (manual QTypeInfo
specialization is another option, and required, for certain template
classes), also check in q_uninitialized_relocate_n().
[ChangeLog][QtCore][QTypeInfo/QTypeInfoMerger] No longer allows
marking as Q_RELOCATABLE_TYPE a type that is neither movable nor
copyable.
Change-Id: If6b3e5c1bfb6538bd280262eefbb08ba3c810e4c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When 3535f46374 dropped the
Q_ASSERT(end[-1] == '"') by reviewer request from the original
767beb7fff change, it didn't replace it
with some other check, leaving the possibility open that we'd be
passing an invalid range (end < begin) to QString::fromUtf8(), with
unknown consequences.
While technically a security problem, this has very low impact, since
the files being parsed should contain "trusted content", being
supposed to be owned by root, and not writable by mere mortals. I
hasten to add, though, that the code doesn't check permissions of the
files it reads.
The bug existed with the original Q_ASSERT, too. Namely in release
mode. And in debug mode, it would be a DOS.
Port to QByteArrayView to get the more expressive API and as a
prerequestite for follow-up (non-security) patches.
Pick-to: 6.6 6.5
Change-Id: Ib79cdad8680861d1f11b6be9234695273d0a97c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QVarLengthArray is the only Qt container currently known to be fine.
std::vector is supposed to be fine, too, since C++14. Turns out that
libstdc++ gets resize(n, v) wrong, though, because it never
implemented the resolution to wg21.link/lwg2033. Known issue, linked
in code comment. Worked around for the time being. Keeping std::vector
in, though, because in this test suite we do cross-check with
std::vector, and other platforms, and most of GCC's std::vector
functions, adhere to the standard.
Pick-to: 6.6 6.5
Change-Id: I26e11c4a100695c604cebcf7e14a1ae5078d9ec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The (internal) docs say that - and _ are ignored, and they're ignored
everywhere, except as suffixes. If the old code only ignored them as
infixes, fine, that would make some sense, but it ignored infixes and
prefixes, so there's no reason for it to not ignore suffixes, too.
Fix by continuing the loop until both input ranges are exhausted, or a
mismatch was found.
[ChangeLog][QtCore][QStringConverter] Fixed a bug where
encodingForName() failed due to trailing characters (`_`, `-`) that
ought to have been ignored.
Pick-to: 6.6 6.5
Change-Id: Iec21489d988eda7d33c744c170f88cd665b73f34
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
There's no restriction on the number of enable_if's in a
template-initializer, so simplify the compareThreeWay() constraints by
having separate constraints each for LeftType and RightType. Fewer
templates to instantiate = faster compile speed.
As a drive-by, drop remove_reference_t. We control all users and all of
them pass already-decayed types.
Change-Id: I17c01c7aa1ac03bb6db4b0bef1371ebc0641641d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Provide a custom variable template to detect float types and
specialize it for QtPrivate::NativeFloat16Type.
This will allow to enable three-way comparison for qfloat16.
Task-number: QTBUG-104113
Change-Id: Id12c42c86f8dc9e233fe39776b0f0e28088de9e1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
... and put it into QtPrivate namespace as NativeFloat16Type.
Keep the qfloat16::NativeFloat definition for SC.
This is in preparation of Qt::compareThreeWay() for NativeFloat16Type
(where available and mis-classified as non-is_floating_point).
Amends 99c7f0419e.
Pick-to: 6.6 6.5
Task-number: QTBUG-104113
Change-Id: Ie12c42c86f8dc9e233fe39776b0f0e28088de9e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
We accepted QSpan as a NIH-type instead of waiting for C++20 and
std::span, because we said that there's no impedance mismatch between
the two, as they both implicitly convert into each other.
But we actually never checked that they do.
Fix this omission by adding constructors that treat std::span exactly
the same as QSpan itself, and adding the respective static_assert()s
to tst_QSpan to check that (within the constraints imposed by the
standard on std::span), they actually do convert into each other.
The only two problematic cases are that fixed-size std::span
constructors are explicit, so span is only constructible, not
convertible, from QSpan. Likewise, for an rvalue QSpan to be
acceptable to the std::span constructor, QSpan needs to opt-in to
enable_borrowed_range (while we're at it, do enable_view, too).
We so far have rejected adding these opt-ins for our own container
classes because we wanted to avoid the compile-time overhead of
including the huge <ranges> header into such central headers as those
that define our containers.
But std::span itself has to specialize these traits, and its range
contructor has to use them, so they must be available from <span>,
too, possibly the stdlib puts the definition into a much smaller
header. So just assume we can specialize it after including just
<span>, provided __cpp_lib_concepts is also defined.
Pick-to: 6.6
Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
My notes inform me that my intent was for QSpan::extent to be size_t,
for compatibility with both its template argument and
std::span::extent.
So fix it to be size_t instead of qsizetype. While extents that go
beyond numeric_limits<qsizetype>::max() will be unusable in practice,
QSpan doesn't actually allocate memory, so declaring one should be
possible, if only for compatibility with std::span, without getting
into a situation where E != extent.
Pick-to: 6.6
Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The docs at cppreference.com hint at a corresponding ctor being added
for C++26 (though I don't see it in eel.is/c++draft, yet).
Even so, replacing former initializer_list functions with QSpan ones
is definitely one of the upcoming use-cases, so test it.
Can't use from_container_impl() here as initializer_list<T> is already
immutable, so QSpan<int> is not compatible, only QSpan<const int>.
Pick-to: 6.6
Change-Id: Iecdf29e629d48313edd5e56d358b9137da76deb6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Hide the base class; the documentation isn't supposed to show this
implementation detail.
Don't use auto return types for the begin/end family of member
functions; QDoc doesn't resolve them, but just shows auto, which,
without seeing the implementation, is pretty useless.
Pick-to: 6.6
Change-Id: If75cc1e7de9c5c1490cb37241739449df4e5d0c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Remove the following CIs from BLACKLIST files as they are no longer
used:
- msvc-2015
- msvc-2017
- windows-7sp1
- opensuse-42.3
- ubuntu 16.04/18.04/20.04
- rhel 6.6/7.4/7.6
- redhatenterpriselinuxworkstation-6.6
Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
EGLFS doesn't allow resizing on top window. These testcases pass on CI, as "eglfs" is not tested, only "offscreen".
Task-number: QTBUG-115777
Change-Id: I6fb09c93e1863b2c9ed9e122078761e6b6e64889
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Add f60fb8f417 also to mapToGlobal.
Amends 67fa2585ac
Avoids crashing in certain applications that use QQuickRenderControl
and QQuickWindows that are not backed by a QPlatformWindow.
Change-Id: Ie4a8bd7837973e7997f9b668f776ca2999147d75
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
...and document the related functions as well.
Pick-to: 6.6
Fixes: QTBUG-116350
Change-Id: I038d59f6af46b29e2123bc8b6c24ff4ffea78bbf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
We will not have time to roll out the proper name change
in 6.7, even though we are not bound by compatibility promises.
In the absence of a holistic migration that covers all Qt modules,
just add the new name with using. The proper solution would be the
reverse: the name changes everywhere and the old class name becomes
available via using; but for now we can live with the reverse,
which still allows new code (such as new examples, and future
application code) use the more descriptive name.
Change-Id: I18e791f4f93cb9b4fae8ec21aeb99b4bf93662f1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
If the view's superview is not our own QIOSDesktopManagerView
then it's either a child window, or the view of a view controller
that's not our own. In both cases we can skip the logic to include
the window level, as that only applies to Qt top level windows.
Pick-to: 6.6 6.5
Change-Id: If8bbf2a79f3be0cbaf6979455b0626b36da71068
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The logic was needed for the old QMacCocoaViewContainer, which was a
QWidget, that set Qt::ForeignWindow, and hence Qt::Window, on its
windowHandle().
The modern way of embedding a foreign window into a widget hierarchy
is via QWindow::fromWinId() and QWidget::createWindowContainer(),
which manages the foreign window as a child QWindow of the window
container's window handle, instead of replacing or modifying the
window container's own window handle.
The opposite case is a QWidget embedded into a foreign/non-widget
window hierarchy. Ideally, in this case, we should return false for
isWindow(), as the function is documented to only return true for
"if the widget is an independent window", and "a window is a widget
that isn't visually the child of any other widget and that usually
has a frame and a window title". This notion is used in many places,
including in QApplication::topLevelWidgets(), which in turn affects
the quit logic of QApplication to prevent quitting the application
as long as the child/embedded widget is visible.
Unfortunately, embedding the widget as a non-Qt::Window is not an
option at this point, as we have a lot of code paths that assume
isWindow() || parentWidget(), and these code paths break down in
flames when we end up dereferencing the (non existing) parent
widget.
As a result of removing the logic, we can now embed a QWidget into
a non-widget window hierarchy as a Qt::Window, without the removed
logic resetting the widget back to a Qt::Widget on create(), which
would send us into into the broken code paths described above.
Removing this logic should not cause issues for child widgets backed
by a native window, as those are created with Qt::Widget window flags,
not Qt::Window, so we never relied on the removed logic to sanitize
those window flags.
Task-number: QTBUG-119652
Change-Id: Id6b8e5c67bf8f83af8c2f1594806f3419303b1a1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
It's literally the same as the std::pair one that immediately follows
it, because QPair these days is just a template alias for std::pair.
Wasn't flagged as an error because it's just a declaration, not a
definition.
Pick-to: 6.6 6.5
Change-Id: I5b47572f6e2a71edb47cbe224801a719ff1e060d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead
of 2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.
Pick-to: 6.6
Change-Id: Icc3586451f081f6166fece52675d5379160f51da
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Add a test running QAbstractItemModelTester on the model.
Pick-to: 6.6
Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.
Drive-by changes:
- Refactor a small while loop
- Use reverse iterators
- Move instead of copy while constructing a QList
- Replace QPair by std::pair (see QTBUG-115841), and also for its CTAD,
otherwise I'd have to spill the types out:
updatedFiles.emplace_back(QPair<QString,QFileInfo>{translateDriveName(driveInfo),
std::move(driveInfo)});
otherwise the clangd complains:
Alias template 'QPair' requires template arguments; argument deduction
only allowed for class templates
Task-number: QTBUG-115841
Pick-to: 6.6 6.5
Change-Id: I942459f039f6db23f7c1928fe758c6dbf339cd2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QXcbWindow::requestActivateWindow() is called from the main thread,
while handleMapNotifyEvent() is called from the XCB event thread.
In a data race, handleMapNotifyEvent sets m_mapped to true, before
requestActivateWindow() checks if it is false and sets
m_deferredActivation to true.
If that happens, a window activation is skipped until the next window
systems event is processed.
This is harmless in a normal application environment, where each mouse
move causes window systems events to be processed. In an autotest
environment, it causes flakiness, because an expected window activation
may or may not happen.
As a workaround, QApplicationPrivate::setActiveWindow() is frequently
called after QWidget::activateWindow() or QWindow::requestActivate(),
to set the active window on application level. In essence, this is
setting expected outcome of a skipped deferred activation by force.
This patch protects access to m_mapped and m_deferredActivation with a
QMutex in both methods. That prevents the data race and ensures all
deferred activations processed.
Calling QApplicationPrivate::setActiveWindow() after activation on
window/widget level becomes redundant.
Task-number: QTBUG-119287
Pick-to: 6.6 6.5
Change-Id: I2eee69292afe0ef6381880a10d4e8483c2c7cbfa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We need an owning container to keep the data alive when the _data
function computes the expected value instead of passing it as a
literal string, so replace the QByteArrayView we used so far with a
const QByteArray.
If a test failed, print the tail ends of the failing strings. This
is useful when toString() implementations printing the operands of
the failed toString()-under-test result comparison decide to
truncate the output. It works around the fact that we both test
toString() and use toString() to report any failure.
As a drive-by, add a missing blank line between function definitions.
Amends a2551c45d4.
Pick-to: 6.6
Change-Id: I0b217aeb1a6d475df8e8b9fb821046f1cceb1a3e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Derive them from the chosen output buffer size instead, itself a
symbolic constant.
Pick-to: 6.6 6.5
Change-Id: I33aa351ba358b106b448f886b92e952e53bc75f9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Use C++14's std::index_sequence instead of our home-brewed
QtPrivate::IndexList. I used make_index_sequence<sizeof...(Types)>
instead of index_sequence_for<Types...> to avoid having to resolve
another type-dependent template alias.
Remove the helper's vacuous \internal qdoc block.
As a drive-by, rename the helper function to prevent it from
participating in QTest::toString() overload resolution, and
fix spaces around &.
Pick-to: 6.6 6.5
Change-Id: I5981a9b1a99fbe741e75820a6954d066ced9573d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
In Qt 6, it is no longer possible to create a weak pointer from a plain
QObject pointer.
Consequently, we don't need the work-aronuds introduced for QTBUG-22622.
Except that we still need to keep the functions as they are exported.
Mark them as QT6_ONLY, so that they'll be gone automatically come Qt 6.
Amends e40320c552.
Change-Id: I568da04008374c891a111eee49f6679dabdfdee4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The cast that prevented it was a remnant of QStringView (which, like
QString itself, stores char16_t, but interfaces in QChar).
Remove the cast, add the constexpr.
[ChangeLog][QtCore][QUtf8StringView] data() is now constexpr, too.
Change-Id: I7891b89bf26176484411b4388ded04e56651b607
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It's required for C++ containers.
Change-Id: Id5b51e1af22ac6e452019e976f50c727bbba6948
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
When I split Qt::partial_ordering off of QPartialOrdering, O
duplicated the partialOrdering() test, but lost the conversion() part
of the tests.
This patch brings them back.
Because we maintained the test coverage for Qt::partial_ordering, it
suffices to check that QPartialOrdering::X correctly maps to
std::partial_ordering::x. The rest follows from transtivity of
equality.
We're still lacking conversions of QPartialOrdering to Qt::_ordering
types. That will be the subject of a follow-up patch.
Amends 4b6f757020.
Change-Id: I1938d09f696ed8d58143dbacccb72cfd54ca12dd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
First, replace double quote characters with 3 escaped double quotes
to allow QProcess::splitCommand() to treat it as an actual quote
character that's part of the tag.
Then, escape single quote characters so they don't interfere with
the shell command and also to be treated as part of the argument.
Lastly, surround the args with escaped double quote so that args
with spaces are also treated as one.
Amends b044323c16.
Example of this:
tst_qkeyevent::modifiers("M","e","t","a") for double quotes
tst_qunicodetools::wordBreakClass(two words) for spaces
tst_QSpinBox::stepSelectAll("don't select all") for single quotes
Task-number: QTQAINFRA-5703
Change-Id: Ie4317e4350bbac619bac41e41f42613f50cf1ad4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
It uses the ciphersuite name which smart tools one day will mark as
weak (i.e. https://ciphersuite.info/cs/TLS_DHE_DSS_WITH_AES_256_CBC_SHA/
in our example), names in the example are not in the standard notation,
+ it is and always was OpenSSL-specific example.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-119464
Change-Id: Ic6f095ff2c861582de756bf220e2e74106b88e83
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This change is required when running in real hw with eglfs backend. It passed on CI because CI used "offscreen" backend and eglfs is not tested on CI at the moment.
Task-number: QTBUG-115777
Change-Id: I4bbfbedcbe21c5c2041be9bdb8ae370156bb6200
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Function is the more popular term in the documentation. Method is
also a tad confusing, because QCryptographicHash calls the algorithm
'method'.
Pick-to: 6.6
Change-Id: I9922f837b04311a4ef45e1c6de6b8e12a32e4f1e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Move the orientation change handling to the display manager
and call it from the relevant places to repeated and scattered
code for the same functionality.
Bring back part of 072387edec
which checks discard a resize event that's not valid that
reports not up to date layout size.
If DisplayManager.DisplayListener.onDisplay() initiates the
orientation change, handle it immediately if we don't expect
the size to change, i.e. if the orientation is changing from
portrait to inverted portrait and vise versa for landscape.
Otherwise, expect the change to be initiated again shortly
after from QtLayout.onSizeChanged().
Also, add improve the unit test of the orientation change,
and test for the widget size after such changes to make
sure QTBUG-94459 is not reached again.
Fixes: QTBUG-119430
Task-number: QTBUG-115019
Task-number: QTBUG-94459
Change-Id: I5f060d91531af677ddf891f2af360d5f399e26e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>