Add two overloads to QNetworkAccessManager to support GET requests
with body.
Modify QNetworkReplyHttpImpl as well as these requests should not
be cached.
If the request is redirected it is possible that its type changes
from POST/PUT to GET and in this case the message body is deleted.
However, if a GET request has a body it should keep it after it has
been redirected - modify QNetworkReplyHttpImpl to keep the message
body after it has been redirected.
Fixes: QTBUG-112871
Change-Id: Ib01898638ed94238a98291870a5c51d56030868a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Slightly improves performance in the new benchmark
Change-Id: I2d71143ff7bc1f32ebb172f20be1843dec123e6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
It deoesn't like single quotes, which must be replaced with doubled-up
double quotes.
Pick-to: 6.2 6.5 6.6
Change-Id: I8e5f8047e72e4433926a9f4f2044407a4d823682
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We were using the .remove(Key) API on the map instead of
erase(iterator), so we were removing any reply of the same priority that
had not yet been popped from the queues.
Rewrote to drop loop and only work with iterators.
This issue was there since SPDY days, so not picking all the way back to
5.15, where HTTP2 anyway is not enabled by default.
As a drive-by, drop the #ifndef QT_NO_SSL, which was also there from
SPDY times, which was TLS-only.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-116167
Change-Id: Id7e1eb311e009b86054c1fe3d049c760d711a18a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Implements an iterator API and other standard member access functions
for sequential containers so that we can use ranged-for over an object
that is a jarray. Provides read-only access to individual elements
(which is mostly relevant for arrays of objects), or the entire data()
as a contiguous memory block (which is useful for arrays of primitive
types).
QJniObject call functions can return QJniArray<T> when the return type
is either explicitly QJniArray<T> or T[], or their Qt equivalent (e.g.
a jbyteArray can be taken or returned as a QByteArray). If the return
type is a jarray type, then a QJniObject is returned as before.
Arrays can be created from a Qt container through a constructor or the
generic fromData named constructor in the QJniArrayBase class, which
implements the generic logic.
Not documented as public API yet.
Added a compile-time test to verify that types are mapped correctly.
The function test coverage is added to the QJniObject auto-test, as
that already provides the Java test class with functions taking and
returning arrays of different types.
Change-Id: I0750fc4f4cce7314df3b10e122eafbcfd68297b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Ensure that this environment variable is respected, as ASAN errors
(e.g. memory leaks) can cause the selftests to fail since they expect
no errors in their output.
Fix an incorrect function name in a comment, while we're at it.
Fixes: QTBUG-118041
Pick-to: 6.5 6.6
Change-Id: I07502101aabd8743df898ae8fe4a693c4733c4af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
These must pass, but they're highly unlikely to be trashable because
/var/tmp is usually not its own filesystem (it might be a subvolume of
its own, but usually isn't). Instead, it's usually part of / or /var.
On my machine:
openat(AT_FDCWD, "/var/.Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/var/.Trash-1000", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
mkdirat(AT_FDCWD, "/var/.Trash-1000", 0700) = -1 EACCES (Permission denied)
Change-Id: Ifeb6206a9fa04424964bfffd17884246a4d27443
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Both QTemporaryFile and QTemporaryDir are documented to use the current
directory if given a pattern. That can be anything & arbitrary, so it
doesn't give us consistency in checking. Moreover, it might be a read-
only directory.
Drive-by fix the number of 'X'.
Task-number: QTBUG-117449
Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd178841c44e9636a0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
QtTest can't handle a test that does both. This ends up recorded as a
skip in the summary.
Pick-to: 6.6
Change-Id: Ifeb6206a9fa04424964bfffd1788412a438085b0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This base class implementation for COM objects provides IUnknown
interface implementation with reference counting which will allow to
keep all this functionality and implementation in the same place.
Pick-to 6.6 6.5
Change-Id: I8ec597b1040ac33295317e06338ffdcb61b78f85
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Makes it easier to get an idea of what went wrong
Change-Id: Idace20ecf008fa906780881b62ed44ac36751123
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It was weird that they were missing. Now that C++23 added them to
std::span, add them to QSpan, too.
Pick-to: 6.6
Change-Id: I4a9b1fdeda66bc7b133c8f7b3b269656e5faffa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
All these TUs relied on transitive includes of qpointer.h, maybe to a
large extent via qevent.h, though, given that qevent.h is more or less
the only public QtBase header that includes qpointer.h, something else
seems to be at play here.
Said qevent.h actually needs QPointer in-name-only, so a forward
declaration would suffice. Prepare for qevent.h dropping the include.
The algorithm I used was:
If the TU mentions 'passiveGrabbers', the name of the QEvent function
that returns QPointers, and the TU doesn't have qpointer.h included
explicitly, include it. That may produce False Positives, but better
safe than sorry. Otherwise, in src/, add an include to all source and
header files which mention QPointer. Exception: if foo.h of a foo.cpp
already includes it, don't include again.
Task-number: QTBUG-117670
Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This changes takes Qt for Android Java code away from the Delegate
classes that uses heavily Java reflection to invoke Activity/Service
calls and overrides. So instead of that, now, we have a QtActivityBase
and a QtServiceBase classes which handle the override logic needed for
Qt directly without reflection.
These Base classes extend Android's Activity and Service directly, and
are inside the internal Qt android package (under Qt6Android.jar).
For example, to handle onConfigurationChanged, instead of the current
way where we need this in QtActivityDelegate:
public void onConfigurationChanged(Configuration configuration)
{
try {
m_super_onConfigurationChanged.invoke(m_activity, configuration);
} catch (Exception e) {
e.printStackTrace();
}
handleUiModeChange(configuration.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
}
And then this in QtActivity:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
if (!QtLoader.invokeDelegate(newConfig).invoked)
super.onConfigurationChanged(newConfig);
}
public void super_onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
And having to keep it's Method handles around and then use Java
reflection
to call the override behavior done by Qt and the superclass methods.
instead of that, we can do it now in QtActivityBase like:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
handleUiModeChange(newConfig.uiMode &
Configuration.UI_MODE_NIGHT_MASK);
}
Then, we would still have our user facing QtActivity class which extends
QtActivityBase and benefit from the same implementation of Qt logic done
in the base class.
An additional benefit to this approach is that now QtActivity will be
very lightweight and doesn't need to have all the boilerplate code as
before.
[ChangeLog][Android] Simplify Qt for Android public bindings
(QActivity, QtService and QtApplication) by implementing base
classes which use the delegate implementions directly and avoid
reflection.
Task-number: QTBUG-115014
Task-number: QTBUG-114593
Change-Id: Ie1eca74f989627be4468786a27e30b16209fc521
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
The loops are iterating over local const containers, so use ranged-for.
Remove '#undef QT_NO_FOREACH'.
Task-number: QTBUG-115839
Change-Id: I252f048e3c469bf9bb34cb0756ccbd57571fd886
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
GestureWidget::ignoredGestures QSet:
- elements are inserted in the container in a top-level test function,
then a CustomEvent is constructed and sendCustomGesture() is called,
which sends the events, invoking the GestureWidget::event() overload,
the latter iterates over the container, thus the container isn't
changed while it's being iterated over, because the code can't recurse
into the top-level test function and that's where the container is
modified later on (by inserting or by calling widget.reset() which
clears the container)
- the loop body doesn't change the container
So use ranged-for and std::as_const.
The same logic applies to the GestureItem::ignoredGestures QSet.
Task-number: QTBUG-115839
Change-Id: Icf95e90a8af5aa7e947035704121557494afc326
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It noted that an unspecified function claimed the offset it was
checking should be +1, while testing it against that or -1. The
function turns out to be QDateTime::addDays(), whose doc did indeed,
misleadingly, say that it lands after a gap it would have hit. It in
fact overshoots the gap in the direction of its change. Amend its
docs, likewise those of addMonths() and addYears(), to reflect the
true behavior.
Amend the test to look at the direction of the step its taking and
anticipate that the adjustment will be in the same direction; then
compare the actual adjustment to that.
Change-Id: I9ab918fac0ab2195ef014983f37fccc435bf0498
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The implementation previously worked for non-short date-times, where
the offset has been remembered since construction. This included the
case of zoned times (and local times more than 2^55 msec away from the
start of 1970) that hit a spring-forward's gap; but excluded local
times that did the same (within 2^55 msec of the epoch).
This precluded an offset check in a spring-forward test, now added.
We can in fact determine the offset whenever we got a valid date and
time (we do so in the course of initializing the object, and when
asked for toMSecsSinceEpoch(), even when invalid), and we should not
use the value of the recorded offset if we didn't get a valid date and
time, so amend to always return 0 if we didn't get valid date and time
and always report the correct offset otherwise.
In the process, amend offsetFromUtc()'s computation to directly
resolve the date-time, rather than doing so via toMSecsSinceEpoch(),
which has to repeat decision-making offsetFromUtc() has already done
by the time it calls it. Also amend toMSecsSinceEpoch() to return 0 if
we didn't have a valid date and time to begin with, so it only
attempts to produce a useful result in the case where construction
attempted to resolve the date-time.
Change-Id: I6574e362275ccc4fbd8de6f0fa875d2e50f3bffe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The resolution selects a point in time outside the gap, which will be
represented by toMSecsSinceEpoch()'s return, despite the QDT object's
isValid() returning false. Previously we retained the
originally-calculated msecs, so as to keep date() and time() matching
what was asked for. However, this required adjusting offset, which was
not remembered for local times within 2^55 milliseconds of the start
of 1970. This lead to an inconsistency between the offset from UTC
reported for the resolution for a local time further from the epoch,
or for a time-zone, and the actual offset from UTC at the time
indicated by the return from toMSecsSinceEpoch().
Instead, retain the actually calculated offset (even if we aren't
going to remember it) and adjust the msecs to the value that ensures
toMSecsSinceEpoch() will get the selected resolution. This
incidentally means that, when toMSecsSinceEpoch() has to re-resolve
(for a local time within 2^55 msecs of the epoch), it avoids
revisiting the complications of hitting the gap.
In passing, change internal stateAtMillis() to take the QTimeZone it
is passed by const reference, to save a copy (noticed during debug).
Also tweak a comment in a test to be explicit about a default value.
[ChangeLog][QtCore][Possibly Significant Behavior Change] When
QDateTime is instantiated for a combination of date and time that was
skipped, by local time or a time-zone, for example during a
spring-forward DST transition, the invalid result's time() - and, in
rare cases, date() - no longer match what was asked for. Instead,
these values and offsetFromUtc() now match the point in time
identified by toMSecsSinceEpoch().
Change-Id: Id61c4274b365750f56442a4a598be5c14cfca689
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
If a QShortcut is registered with a QWindow as its parent, but QApplication
is used, we end up in QApplicationPrivate::createShortcutPrivate(), and
create a QtWidgetsShortcutPrivate that implements shortcut context matching
via qWidgetShortcutContextMatcher.
The problem is that qWidgetShortcutContextMatcher expects the windows
to be QWidgetWindows, which meant that plain QWindow based shortcuts
would always fail.
This can happen for example if a QApplication is used in Qt Quick
to provide dialog fallbacks, but QShortcuts are otherwise used
with plain QWindows, or QQuickWindows e.g.
We now defer the check of whether there's an active (widget) window,
and fall back to QtGui's simpleContextMatcher in case we don't find
a QWidget, QAction, or QGraphicsWidget shortcut owner to handle
the matching for.
Note: We don't support shortcut matching for QAction in QtGui,
but this is left for another day. There is also a discrepancy
between how QtGui and QtWidgets handles Qt::ApplicationShortcut.
The former will treat it as a match even if there is no active
QWindow, while the latter requires that there's an active widget
window.
Fixes: QTBUG-116221
Change-Id: I487995f2e660a40f6556828b84a521d81a58f1b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
After d9bb8c0a17 we call inputDirection()
on the platform input context to initialize the direction at startup.
The test can't assume there are no other callers to the functions
in the QPlatformInputContext layer.
Change-Id: Ic1cecd608b2759e703a17838fcf24b4ff53ad07e
Reviewed-by: Liang Qi <liang.qi@qt.io>
It's very hard to test on Android otherwise: Creator isn't cooperating
well enough with Android Studio / SDK manager with where stuff is
installed, qmake doesn't build an apk, and qt-cmake-standalone-test
doesn't work wth Android either.
Renamed the executable to tablet_device_info so it's a bit less
confusing on device launcher UIs.
Task-number: QTBUG-86297
Change-Id: I3bb7f816e43f8df4183be1c0866e228befa9e8d9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Since it hides QFile's overloads this was not supported for
QTemporaryFile.
[ChangeLog][QtCore][QTemporaryFile] Added support for passing
std::filesystem::path to rename and createNativeFile.
Change-Id: I909ff1d5b9c586824c9901d7dad278dfad09ffc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We were already doing this for a key combination without modifiers,
but now we do the same for e.g. Control+Unknown. This matches the
behavior we have for QKeySequencePrivate::decodeString(), where
we return Qt::Key_Unknown if we can't resolve the key, even if
we have resolved some valid modifiers, e.g. "Meta+Trolls" as in
the tst_QKeySequence::parseString() test.
Change-Id: I238e29276e6ce356ae60c67585739587fa388f07
Reviewed-by: Liang Qi <liang.qi@qt.io>
Added moveToTrashDuplicateName() to see what happens if you attempt to
trash two files with the same exact full path. Both files should get
independently moved to the trash bin and not clobber each other.
Added moveToTrashXdgSafety() to test that QFileSystemEngine will
properly skip over an unsafe $root/.Trash directory, as required by the
XDG specification. I think the specification should also make security
requirements on $root/.Trash-$uid too, but that's for another change.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786cd60e4244c7c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
qnativesocketengine_win.cpp: don't check if timeout is < 0, because
remainingTimeAsDuration() doesn't return negative values.
All the changes done in one go, not function by function, as that causes
the least churn. You can think of them as a couple of very similar
changes repeated various times.
Drive-by change: replace `forever {` with `for (;;)`
Task-number: QTBUG-113518
Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When a dock widget is closed while floating, it still reports being
floating even though the QWidget::windowHandle()->isVisible() returns
false. This is documented behavior and will not be changed.
c153066baa relied on the isFloating() to
return false, if the dock widget is closed. When the window title was
changed by setWindowTitle(), the change was overridden by reading the
old value from the window handle.
=> Amend the patch and add a windowHandle()->isVisible() as a condition.
In c153066baa, an autotest for the title
propagation (QTBUG-113591) was added to floatingTabs().
=> Harden the setWindowTitle() test function. Move the tests related to
QTBUG-113591 and QTBUG-117764 to this function.
Fixes: QTBUG-117764
Pick-to: 6.6 6.5
Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
By fixing how many requests we are expecting to _finish_.
Since the nRequests variable is only decreased once a
request is finished, we only actually expect 1. No matter
how many times it gets redirected.
This was the slowest test-function in the test, clocking in at
10 seconds. Now it's sub 500ms.
Pick-to: 6.6 6.5
Change-Id: I544360f0928466c1bc0fbc6806952ccec588d131
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Otherwise characters in right to left languages like Hebrew might
mess up the output.
Change-Id: I8753e7e672159ed515dc6152c3629adf91cfd4a9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
- remove unused includes / replace with qabstractitemdelegate.h
- replace references in the documentation with QStyledItemDelegate
- adjust the examples and tests to use QStyledItemDelegate
Pick-to: 6.5 6.6
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
On some xcb platforms the xcb_configure_notify_event_t is sent after the
window is fully exposed which leads to a wrong position for
QWidget::mapToGlobal() which makes the test fail.
Fix it by waiting for a move event with a position != 0,0 before
starting the drag'n'drop operation.
Fixes: QTBUG-94250
Change-Id: If91a15815205ba9dcea36248d9de03ed0a7e5822
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
and add QChar overload to reduce allocations
Also port tests from char* literals to char16_t literals
Change-Id: I99381a2da08d9d35e6135c48bd92bd8d72533065
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Construction from nullptr wasn't, before, because it was using the
QPointer(T*) constructor, which cannot be constexpr. Add a constexpr
QPointer(std::nullptr_t) constructor to enable this use-case.
This requires to mark the (T*) constructor as Q_WEAK_OVERLOAD,
otherwise legacy construction from a literal 0 would be ambiguous.
No documentation changes needed, as the set of valid expressions
(apart from constinit'ing) has not changed. Mention the nullptr ctor,
though, without \since.
Add a test to confirm that contruction from derived still works.
Change-Id: If9d5281f6eca0c408a69f03fecba64a70a0c9cf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Ignore expected warning messages when looking up classes, methods, or
field that don't exist. Make the test implicitly fail for any other
warning messages.
Change-Id: I79ec799102b1ab9424aa39c5255413931b8ad152
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
In non-static builds, of course.
Change-Id: Ifbf974a4d10745b099b1fffd1777ac97c0921759
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The whole Q_DECLARE_METATYPE part is superfluous in these two examples,
as QVariant works with any type as long as it is copy-constructible.
And QVariant will call the equivalent of qRegisterMetaType, so that
doesn't need to happen, either.
Showing how to integrate the type with qDebug is fine in theory, but
also a repetition of content that can be found in other places.
Given that there isn't much else being shown in these two examples, it's
better to remove them from examples and move them to manual tests.
Some parts of "Custom Type Example" were used as snippets in other
documentations under qtbase/src/corelib. So, they were added in
customtypeexample.cpp file in the snippets folder.
Fixes: QTBUG-117001
Pick-to: 6.6 6.5
Change-Id: I45b16338912e3f7394cbb5169642bd31af32d5e1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
A Qt::ApplicationShortcut shortcut is not tied to a specific window.
We do however document that the shortcut "is active when one of the
applications windows are active", which seems like a strange limitation,
but for now we honor it in our test as well by making another window
active.
Change-Id: I235230ff69df29ee43d356d3efaeedb20071faf3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Construction from nullptr isn't, because it's using the QPointer(T*)
constructor, which cannot be constexpr.
Pick-to: 6.6 6.5
Change-Id: I19129a0fca5873e83d20351a909a7994399bfcce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a testcase to make sure the signals for moveing rows are properly
connected from the model to the corresponding QHeaderView slots.
Task-number: QTBUG-117698
Pick-to: 6.6 6.5
Change-Id: I354f8836d3de58a8bf51da7a8c0859a673ec9339
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Named instances of variable application fonts are exposed
automatically through CTFontManagerCreateFontDescriptorsFromData()
(and also for the URL equivalent).
The main change here is just to call this instead of the overload
which only returns the first font.
Note that this also updates the test: This is because the conversion
from CoreText normalized weight values to TTF values is not 100%.
In the CoreText code, we map Heavy (0.56) to ExtraBold, but ExtraBold
gets converted to 0.6, which is closer to the CoreText value for Black
(0.62).
To avoid hitting this inconsistency, the QtExtraBold has been changed
to Black weight instead, which resolves to the same on all platforms.
Task-number: QTBUG-108624
Change-Id: Ied6d42e9e3e1ba8b7102936c5be3d285b3d9e07f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
There's no need for the manual sendKeyEvent, as QTest already
has the ability to send synthetic clicks, and we don't need
a colored window to test shortcut activation.
Pick-to: 6.6
Change-Id: I8409888664e2316bec4ea64f21dbb8b6915091f4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
- Initialize QStringList with an initializer_list instead of old style
operator <<()
- Use Qt::StringLiterals more, better readability
- Test CaseSensitivity
Change-Id: If7dde14333d54b8c2f682036634ad94d5f9f9c74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For GDI, there doesn't seem to be any way to do this, so it depends
on selecting the DirectWrite font database explicitly.
This moves the supportsVariableApplicationFonts() check into the
QPlatformFontDatabase instead of the font engine, since that's
where it belongs.
[ChangeLog][Fonts] Added support for selecting named instances in
variable application fonts when using the DirectWrite backend.
Task-number: QTBUG-108624
Change-Id: I51e0fedd7a9616088a06453a1d17f48bd18fa5a7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Fix runtime warnings about testdata with the same name.
Pick-to: 6.6 6.5
Change-Id: I5d4927cc53be3e08a524498db42a8a08396ced8e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The jbyte type is a signed char, which also promotes to int in variadic
argument functions.
Extend the test case to make sure that we don't get any warnings for
the most relevant parameter types.
Change-Id: I7811e1eebdbc989ab5989eb1a2c502acd0540bc7
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
When changing the selected index in a combo box,
also update the current index in the item view's
selection model right away, and don't delay this
until when the combobox popup gets shown in
QComboBox::showPopup.
This is needed to make sure that the selection
is properly exposed to the accessibility layer.
On the accessibility layer, QAccessibleComboBox,
the a11y implementation for the combobox, exposes
the entries in its list child
(s. QAccessibleComboBox::child) and Orca queries
the selected item when the combobox gets focus,
which didn't return the proper results earlier,
resulting in no or the wrong entry getting
announced.
Extend the existing combobox a11y tests
accordingly.
Pick-to: 6.6 6.5
Fixes: QTBUG-117644
Change-Id: Ia26de5eafd229f7686745a2fbe03fc1eb6a713f8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Implement the missing overload to handle UTF-8 specific data types,
including char8_t (C++20), char, uchar and signed char.
Introduce the helper function 'assign_helper_char8' which handles the
non-contiguous_iterator case. The contiguous_iterator case is already
handled by the QAnyStringView overload.
Include 'qstringconverter.h' at the end of the file, since it can't
be included at the top due to diamond dependency conflicts.
QStringDecoder is an implementation detail we don't want users to
depend on when using assign(it, it). It would be unnatural to not
be able to use a function just because we didn't include an
apparently unrelated header.
[ChangeLog][QtCore][QString] Enabled assign() for UTF-8 data types.
Fixes: QTBUG-114208
Change-Id: Ia39bbb70ca105a6bbf1a131b2533f29a919ff66d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This change can be described in the following 2 categories:
1. Support 3 ways to escape identifiers mentioned in SQLite Keywords
In SQLite Keywords (https://sqlite.org/lang_keywords.html), it shows
that there are 3 ways to escape identifiers, i.e., "", [], ``. So, I
have overridden "bool isIdentifierEscaped(const QString &,
IdentifierType)" to support it. In addition, there was a bug of
_q_escapeIdentifier. If there is a field name called length [cm],
which uses square brackets to show units, _q_escapeIdentifier will
not escape it to "length [cm]".
2. Identify identifiers correctly if identifiers have been escaped
There is a bug of QSQLiteDriver::record and
QSQLiteDriver::primaryIndex.
If we input escaped identifiers with separator, let's say
"databaseName"."tableName", both will change the input into
databaseName"."tableName, which is incorrect and causes
qGetTableInfo cannot get the right results. In addition, I overrode
stripDelimiters to strip "databaseName"."tableName" correctly.
There are still some assumptions for isIdentifierEscaped,
escapeIdentifier, and stripDelimiters, but I think this change it better
than what we have now.
1. For isIdentifierEscaped, if identifiers have a dot and the dot is a
separator, it is the users' responsibility to escape the pair of
schema and table name correctly. For example,
"aSchemaName"."aTableName", not "aSchemaName".a"TableName". That's
because we don't know whether the dot is just a dot of the name or a
separator.
2. For escapeIdentifier, if identifiers have a dot and the parts before
and after the dot are not escaped, escapeIdentifier will treat the
dot as part of the table name or field name. The same as the item
above, it is users' responsibility to do it right.
3. For stripDelimiters, the same as above, it is users' responsibility
to do escape if users want to use format schemaName.tableName or
tableName.fieldName.
Change-Id: I9d036a2a96180f8542436188f75a220a0fe58257
Reviewed-by: Po-Hao Su <supohaosu@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
We want to test the traits even on nonsensical types.
Change-Id: I63ed022c9529d9de9d336157e6f025937321ca16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Now that QtJniTypes::Objects are no longer primitive types that are the
same as a jobject, using those types in registered native functions
breaks. JNI will call those function with a jobject on the function
pointer, and lacking any type safety, the call to the registered
function will proceed with a wrong type of object on the stack.
To fix that, register the native function via a proxy that is a variadic
argument function, and unpack the variadic arguments into a list of
typed arguments, using the types we know the user-code function wants.
Then call the function with a tuple of those types using std::apply,
which gives us type safety and implicit conversion for free.
Add a test that exercises this.
Change-Id: I9f980e55d3d13f8fc16c410dc0d17dbdc200cb47
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Instead of having a type that doesn't behave like a QJniObject, which
includes not holding a proper reference on the Java object, make the
QtJniTypes::Object type a QJniObject subclass that can be specialized
via CRTP to provide type-specific constructor and static functions.
QJniObject doesn't have a virtual destructor, but we subclass it only to
add a typed interface, without adding any additional data members.
Add versions of the static functions from QJniObjects to the
QtJniTypes::Object so that they can be called without explicitly
specifying the type or class name. This includes a constructor and named
constructors.
Constructing such objects means constructing a Java object of the class
the object type represents, as per the Q_DECLARE_JNI_CLASS declaration.
This is not without ambiguity, as constructing a type with a jobject
parameter can mean that a type wrapping an existing jobject should be
created, or that a Java object should be created with the provided
jobject as the parameter to the constructor (e.g. a copy constructor).
This ambiguity is for now inevitable; we need to be able to implicitly
convert jobject to such types. However, named constructors are provided
so that client code can avoid the ambiguity.
To prevent unnecessary default constructed QJniObjects that are then
replaced immediately with a properly constructed object, add a protected
QJniObject constructor that creates an uninitialized object (e.g. with
the d-pointer being nullptr), which we can then assign the constructed
jobject to using the available assignment operator. Add the special
copy and move constructor and assignment operators as explicit members
for clarity, even though the can all be defaulted.
Such QJniObject subclasses can then be transparently passed as arguments
into JNI call functions that expect a jobject representation, with the
QtJniTypes::Traits specialization from the type declaration providing the
correct signature.
QJniObject's API includes a lot of legacy overloads: with variadic
arguments, a explicit signature string, and jclass/jmethodID parameters
that are completely unused within Qt itself. In addition the explicit
"Object" member functions to explicitly call the version that returns a
jobject (and then a QJniObject). All this call-side complexity is taken
care of by the compile-time signature generation, implicit class type,
and template argument deduction. Overloads taking a jclass or jmethod
are not used anywhere in Qt, which is perhaps an indicator that they,
while nice to have, are too hard to use even for ourselves.
For the modern QtJniTypes class instantiations, remove all the overhead
and reduce the API to the small set of functions that are used all over
the place, and that don't require an explicit signature, or class/method
lookup.
This is a source incompatible change, as now QJniTypes::Object is no
longer a primitive type, and no longer binary equivalent to jobject.
However, this is acceptable as the API has so far been undocumented,
and is only used internally in Qt (and changes to adapt are largely
already merged).
Change-Id: I6d14c09c8165652095f30511f04dc17217245bf5
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
If we construct the QJniObject from a jobject, then we know the jclass,
but not the class's name. If className is called while the stored name
is empty, get the name of the jclass and updated the stored value.
Change-Id: Ic3332a6da2dac1eb6842f90da1b9264398a43155
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
currentCompatProperty should point to the compat property that's
currently being evaluated. As soon as we start evaluating a new compat
property, it's invalid by definition. Temporarily disable it then.
Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-109465
Change-Id: I7baba9350ebf488370a63a71f0f8dbd7516bf578
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
To be used in QWeakPointer.
Change-Id: I5ee9dd0862a0b23d316aaadf5d68bef1ce609e8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fail the test when an unexpected warning message about a field, class,
or method not being found is generated from a JNI exception. Fix the
failure when trying to look-up a boolean field that is no longer
available, and ignore the one expected message from looking up an
unavailable class explicitly.
Change-Id: Ic5e4c003c64272f06a6d4da028e232abba75c4e4
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Support this both for parameters and return types, in all template
functions for calling methods or accessing fields.
To manage the life-time of the temporary objects, create a local stack
frame in the JVM around the calling function. Popping that implicilty
releases all local refernces, so that we don't have to worry about
doing so explicilty. Adding a local reference to the temporary jstring
objects is then enough for the object to live as long as it's needed.
The LocalFrame RAII-like type needs a QJniEnvironment to push and pop
the frame in the JVM, so we don't need a local QJniEnvironment anymore.
Reduce code duplication a bit as a drive-by, and add test coverage.
Change-Id: I801a1b006eea5af02f57d8bb7cca089508dadd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Add compile-time testing to make sure that we can declare a JNI
class String that maps to java/lang/String.
Change-Id: I2b68b2b46112e56b279f3fcddc3d71847a005924
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
QlistWidgets with sorting enabled do not sort stable. A re-sort is
triggered when any Qt::ItemDataRole is changed and not only when
Qt::DisplayRole is changed. Due to an unstable optimization, the changed
element gets inserted at the beginning of their respective "equivalence
group".
This patch disables the optimization and ensures stable sorting
with std::stable_sort. Sorting is only performed, if the subset of
changed items in the range [begin, end] is not already sorted in the
whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check.
Limits / side effect:
The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets.
Task-number: QTBUG-113123
Pick-to: 6.5 6.6
Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>,
even if X* is convertible to T*, actually doing the conversion
requires access to the pointee's vtable in case of virtual inheritance.
For instance:
class Base { virtual ~Base(); };
class Derived : public virtual Base {};
Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is
implicit (it's a public base), but the compiler needs to dereference
`ptr` to find out where the Base sub-object is.
This access to the pointee requires protection, because by the time we
attempt the cast the pointee may have already been destroyed, or it's
being destroyed by another thread. Do that by going through a shared
pointer. (This matches the existing code for the converting assignment.)
This requires changing the private assign() method, used by QPointer, to
avoid going through a converting move assignment/construction, because
one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer.
Given it's the caller's responsibility to guard the lifetime of the
pointee passed into assign(), I can simply build a QWeakPointer<T> and
use ordinary (i.e. non-converting) move assignment instead.
Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1
Pick-to: 6.5 6.6
Fixes: QTBUG-117483
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QAbstractItemView installs the delegate as an event filter on the
editor, so the delegate will get the focusOut event (and other
events) before the editor does. QAbstractItemDelegate will then
emit commitData, signaling that the "updated" data should be
written back to the model.
In the case where the editor of a delegate (QAbstractItemDelegate)
is a QSpinBox with keyboardTracking set to false, the value of
the spinbox won't be updated while typing, but only when the
spinbox's text edit focus is lost. In this case, the delegate's
commitData will be emitted before the spinbox has had a chance
to update the value in its handling of the focusOut event.
To fix, make sure to update the value before the data is
committed to the model in the delegate's tryFixup method.
Fixes: QTBUG-116926
Pick-to: 6.5 6.6
Change-Id: I68540964342407d23387e4404a0fe3f00d80eb5f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.
MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.
If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.
Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.
Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
d026fad3d9 added converting constructors
for QPointer. This however made converting _assignments_ ambiguous,
introducing a regression for users coming from Qt < 6.6.
This code:
QPointer<Base> base;
QPointer<Derived> derived;
base = derived;
used to convert `derived` to `Derived *` (using the implicit conversion
operator from `QPointer<Derived>` to `Derived *`), and then the
assignment operator for `QPointer<Base>` that took a `Base *`.
The introduction of the conversion constructor in 6.6 makes it possible
to convert `QPointer<Derived>` to `QPointer<Base>`, and then fall back
to the compiler-generated assignment operator for `QPointer<Base>`.
The result is that the code above is now ambiguous and stops compiling.
Fix this by adding a converting assignment operator for QPointer.
I'm only adding the const-lvalue overload because the implementation
requires going through the private QWeakPointer::assign helper. We
cannot copy-assign or move-assign the inner QWeakPointer, as those
assignments require lock()ing the QWeakPointer and that's not possible
on a QObject-tracking QWeakPointer (but cf. QTBUG-117483).
Assigning from a rvalue QPointer would mean calling assign() on
the internal QWeakPointer _and_ clear the incoming QPointer,
and that's strictly worse than the lvalue overload (where we just call
assign()).
Change-Id: I33fb2a22b3d5110284d78e3d7c6cc79a5b73b67b
Pick-to: 6.6 6.6.0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Makes it easier to locate later which test may be leaking stuff.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The moveToTrash tests, on XDG platforms, would be trashing to
~/.local/share/Trash. Unlike Windows and Apple systems, the XDG trash
spec creates two files and these tests weren't deleting both of them, so
we had a slow increase of left-over files in ~/.local/share/Trash/info.
Cleaning up ~/.qttest is left as an exercise for the users. For example,
$ cat ~/.config/user-tmpfiles.d/qttest.conf
#Type Path Mode User Group Age Argument
e %h/.qttest 0700 - - 1w
Pick-to: 6.6 6.5 6.2
Change-Id: I9d43e5b91eb142d6945cfffd1786aeff91d34fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The project has been superseded by Qt for WebAssembly and was
never supported in Qt 6.
Pick-to: 6.6 6.5
Change-Id: I36682cfe3ce6adac76a307b0faba97dcb7c655cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Android APIs use integer constants like enum values, so they are mapped
to one of the integeral types (jint, jshort, jlong etc) on the C++ side.
Enable C++ code to declare an equivalent enum (scoped or unscoped), and
to use that enum as a type in JNI calls by treating it as the underlying
type in the signature() generator.
Add a helper type trait that maps enums to their underlying type and
other integral types to themselves (we can't use std::underlying_type_t
on a non-enum type). Add tests.
Note: Java Enums are special classes with fields; this change does not
add any special support for those.
Change-Id: Iec430a1553152dcf7a24209aaebbeceb1c6e38a8
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Don't get a QModelIndex out of a temporary QPersistentModelIndex.
Pick-to: 6.6
Change-Id: Ida9e25f1a17130e19b75221e1189e6f2fccd3f27
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
- provide an asset catalog .json file for both Xcode 13 and 14
formats. Apps built against the Xcode 13 SDK are not validated
anymore by the App store, but it's still useful to see how things
were before.
- Xcode 13 required the following icon sizes for a universal iOS app:
60x60@2x, 76x76@2x\~ipad, 167x167, 1024x1024
- Xcode 14 only needs the 1024x1024 one
- icons need to be embedded into the asset catalog starting with iOS
11 according to Apple docs (not sure which Xcode version, but it's
needed for both Xcode 13 and Xcode 14), and they don't have to
manually be copied into the bundle anymore, Xcode takes care of
that when processing the asset catalog
- add an 167x167 icon image for the iPad pro for Xcode 13
- add an 1024x1024 icon image that is required for successful app store
submission and embed it into the asset catalogs
- for Xcode 13, we need to manually specify all the required icon
sizes
- for Xcode 14 we can rely on Xcode to generate the smaller icons from
the big one
- because the icons need to live in the asset catalog folder, remove
unnecessary icons in the appicons folder.
- for the cmake project, make sure the asset catalog compiler generates
the icons by setting the
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME attribute
qmake does automatically already.
it would be nice if we can do that automatically in a future Qt
version
- remove unused icon references in Info.plist file with Xcode 13
- remove all icon references in Info.plist with Xcode 14, rely on Xcode
to add that info via its generated partial Info.plist file that gets
merged into the main one.
- don't include CMakeLists.txt as a text resource
Amends cf3535fdf2
Pick-to: 6.5 6.6
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I0bc556e66647a66bc21402ea62db3374d0970e97
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The value needs to be 'CustomLaunchScreen', not
'CustomLaunchScreen.storyboard', otherwise app store validation will
fail with the following error:
Asset validation failed
Invalid bundle. Because your app supports Multitasking on iPad, you
need to include the CustomLaunchScreen.storyboard launch storyboard
file in you bundle. Use UILaunchScreen instead if the app’s
MinimumOSVersion is 14 or higher and you prefer to configure the
launch screen without storyboards.
This brings the value in line with what we have for the qmake
Info.plist file.
Amends cf3535fdf2
Pick-to: 6.5 6.6
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I4e9cc2ed685634544955e967f35fdc426dac0f0c
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It is required for publishing an app to the app store. Otherwise during
app store validation phase, you get an error:
Asset validation failed
Missing Info.plist value. A value for the Info.plist key
'CFBundleIconName' is missing in the bundle 'foo'. Apps built with
iOS 11 or later SDK must supply app icons in an asset catalog and must
also provide a value for this Info.plist key.
For more information see
http://help.apple.com/xcode/mac/current/#/dev10510b1f7.
Note this is not needed when using Xcode 14.3+ and when one places the
icons into an asset catalog. When processing icons in the asset
catalog, Xcode generates a partial Info.plist file that will contain
the CFBundleIconName key and will merge into the final Info.plist
file.
Amends cf3535fdf2
Pick-to: 6.5 6.6
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I53009097cf27b096c72ee9c4bad6aa4286272061
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Equivalent to get/setStaticField.
Add a test, and tighten up the surrounding test code a bit.
Change-Id: Ic0993c5d6223f4de271cb01baf727459b5167f94
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Template functions don't permit partial specialization, e.g. we cannot
specialize typeSignature() to return an array signature for any
std::vector or QList type. We need to do that for better array support,
so move those functions as static members into a template class, which
then can be specialized.
Since submodules are both calling and specializing typeSignature and
className as template functions, keep and use those until the porting is
complete.
Change-Id: I74ec957fc41f78046cd9d0f803d8cc9d1e56672b
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
The type lives in the QtJniTypes namespace, which is where types end up
that are declared through the Q_DECLARE_JNI_CLASS/TYPE macros. Having a
String type in that namespace prevents us from declaring the Java String
class as a QtJniTypes type, which is silly.
Perhaps this type becomes obsolete at some point with std::string being
a constexpr type in C++23, but until then we need it. It has no ABI, so
renaming it us safe.
Until submodules are ported, leave a compatibility alias String type,
which also prevents us from declaring a String JNI class in tests until
the alias is removed in a later commit.
Change-Id: I489a40a9b9e94e6495cf54548238438e9220d5c1
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Amends 4f4a8e75ab, after which
QItemSelectionModel printed a warning when destroying the model.
We reset the selection model in response to the model getting destroyed,
and since the model is already set to be nullptr at this point the
select() function complains about changing the selection with no model
set being a no-op.
Fix this by not calling reset() when the model gets destroyed - the
stored selection and currentIndex are already reset at this point -
and instead only call reset() when a new model is set in initModel.
Fixes: QTBUG-117200
Pick-to: 6.6.0 6.6 6.5 6.2
Change-Id: I12fc6b3fb2f2ff2a34b46988d5f58151123f9976
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
If the QCommandLineOption doesn't have a valueName, the parser won't
read the argument, therefore returning an empty value. If the developers
are calling ::value on the option, they clearly think it's expected to
get a value but won't ever be getting one, so we better warn them about
it.
Change-Id: I434b94c0b817b5d9d137c17f32b92af363f93eb8
Reviewed-by: David Faure <david.faure@kdab.com>
Use recursive descent to handle parentheses in config condition
expressions. This fixes cases like 'NOT (A AND B)'.
Fixes: QTBUG-117053
Change-Id: Iab1b6173abe00d763808bb972a9a5443ffa0938d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
[ChangeLog][QtWidgets][QDockWidget] A floating dockwidget that doesn't
have the DockWidgetClosable feature flag set can no longer be closed by
a call to QWidget::close or a corresponding keyboard shortcut (such as
Alt+F4).
Fixes: QTBUG-116752
Pick-to: 6.6 6.5
Change-Id: I7859a2eed11f0e4ee013f7f56611e282e9bcae9a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This serves as regression test for future fixes of the config condition
evaluator.
Task-number: QTBUG-117053
Change-Id: Ib05fe5f5fb6aa2d440ecbc8affaf99b040553c06
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
When loading the fonts, we go through all the named instances
and register these as subfamilies. In addition to exposing these
variants by style name, we also register them with the according
weights, italic style and stretch. This adds a field to FontFile
to allow piping the instance index through to when we instantiate
the face.
[ChangeLog][Fonts] Added support for selecting named instances in
variable application fonts when using the Freetype backend.
Task-number: QTBUG-108624
Change-Id: I57ef6b4802756dd408c3aae1f8a6c792a89bee6a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The XML stream writer previously added namespace declarations with the
same URL as existing ones, but new names, and renamed the XML elements
to use the new namespaces instead of the existing ones.
[ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter.
Pick-to: 6.5 6.6
Fixes: QTBUG-75456
Change-Id: I90706e067ac9991e9e6cd79ccb2373e4c6210b7b
Done-With: Philip Allgaier <philip.allgaier@bpcompass.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Not only are we subject to Q and P defines, we're also included in the
unnamed namespace now.
Amends df030e06a8.
Pick-to: 6.6
Change-Id: Ie2f4c9f45d9845d8a26140e0e1214e87b615ff02
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Simple window with a rotating rectangle that can be
captured using QGraphicsFrameCapture.
Task-number: QTBUG-116146
Change-Id: Ia3b6928e469d926c53260ee40ed5af97dd280c08
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
The QVariant(QMetaType) constructor is a major anti-pattern: unlike
*every* other QVariant's constructor, it doesn't build a QVariant
holding the QMetaType object, but a QVariant of the specified type.
Introduce a named constructor for this use case instead.
In principle, this should lead to a deprecation of the QMetaType
constructor... except that it's used everywhere, so I can't do it at
this time.
Drive-by, improve the documentation of the QVariant(QMetaType)
constructor (since it's basically c&p for the new fromMetaType
function).
[ChangeLog][QtCore][QVariant] Added the QVariant::fromMetaType named
constructor, that builds a QVariant of a given QMetaType.
Change-Id: I4a499526bd0fe98eed0c1a3e91bcfc21efa9e352
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
That we have two macros to declare a C++ type to represent a Java class
is confusing. The TYPE macro as of now allows us to declare array types,
but with QJniArray we won't need that anymore, and can just use Class[]
as the type instead. Changing that will be a follow-up commit; for now,
get rid of TYPE-usages to declare regular classes.
Change-Id: Iea0a9548772ca701148442412cf6ad567583213f
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This is needed to support passing it to other processes so they can
enable legacy, compatibility mode. Right now, there's no such code, but
I am 90% certain we'll need it soon in 6.6.x, if not for compatibility
changes in the future.
There's a bug in passing a QNativeIpcKey to another process that causes
QSharedMemory to use the wrong QSystemSemaphore for control (a feature
that should never have existed in the first place, but we're 15 years
too late on that). I have not yet investigated a fix for this, but it
will likely involve knowing the original legacy key.
Pick-to: 6.6 6.6.0
Change-Id: Idd5e1bb52be047d7b4fffffd1750b547013cb336
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
So we can add them in the future but cause older versions of Qt to
reject them if they don't know what they are.
Pick-to: 6.6 6.6.0
Change-Id: I512648fd617741199e67fffd1782b85935bb832a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Also move some docs from asBackendZone() to systemTimeZone(), making
clear that the system zone object is current at the time of creation
and won't be updated if the system is reconfigured. Adapt some tests
to fail and make clear that the system is misconfigured if no valid
system zone is found.
[ChangeLog][QtCore][QTimeZone] If systemTimeZone() is unable to
identify a valid system time zone, it now produces a warning the first
time it encounters the problem.
Task-number: QTBUG-116017
Change-Id: Ia437d8a03ff3cbf2b2cd98e8a8c3aebe50c1ee32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
whenAll() and whenAny() create a shared context object which is
referenced by the continuation lambda. The refcount of context is only
correctly managed when it is copied non-const to the lambda's
capture list.
Fixes: QTBUG-116731
Pick-to: 6.6 6.6.0
Change-Id: I8e79e1a0dc867f69bbacf1ed873f353a18f6ad38
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There's no need for atomic semantics for a simple "scope value
rollback" (not sure why the code doesn't use the real thing).
There's also no semantics that make sense.
Extract the integer out of the atomic and store it back.
Change-Id: I8ba89216d1931a73ff22a8af7fd656c3f6948793
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Compilers that support 128-bit integer types usually don't have
support for 128-bit literals, so provide Q_(U)INT128_C macros and back
them with UDLs. This, of course, only works in C++, so until compilers
provide built-in literals that support C, too, that's all we get.
[ChangeLog][QtCore] Added Q_INT128_C() and Q_UINT128_C() macros to
create qint128 and quint128 literals in a platform-independent way.
Pick-to: 6.6 6.6.0
Fixes: QTBUG-116822
Change-Id: I4be645baf2e007ee1aa1a27f9b5166671806dc49
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is part of our testing effort where we try enabling more tests for
Web Assembly platform on CI. Not all tests work out of box, so some of
them will require followup work.
This commmit also introduces a new mechanism of automatically renaming
files when they are added many times with the same filename to single
translation unit.
Change-Id: I620536494ea83aeb9b294c4a35ef72b51e85a38b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This fixes the recently added QEXPECT_FAIL about glob-deleteall
in a local directory (with a binary cache). Before adding a glob match
we ask the more-local (higher-precedence) directories if they have
a glob-deleteall for that mimetype, and skip it then. This "asking"
is a virtual method, implemented for both XML and binary providers.
Change-Id: I6e4baf0120749f3331fd2d9254bea750a322b72d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old name Asia/Calcutta is being phased out. We can't assign
QTzTZP, so select between new name and old using a reference variable.
In the process, fix a QCOMPARE() against bool to a QVERIFY().
Pick-to: 6.6 6.5
Change-Id: I7cd8a813f8a88c8ae4ba07213f04f4ad0860cec0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d648, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).
The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.
Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When running tst_qmimedatabase with the full shared-mime-info test suite
(which unfortunately requires local setup so this is easy to overlook),
we need *.webm to still be associated with video/webm.
So to test glob-deleteall, do that in installNewLocalMimeType(), with
other similar tests.
This however unearthed the following bug: the handling of glob-deleteall
is only correct when the local dir has no binary cache. It's broken
when using a binary cache. Added a QEXPECT_FAIL for now because this is
going to be fixed as part of a major redesign, coming up.
I also found out that neither xdgmime nor gio do this correctly...
Change-Id: Ib075fcdb792f60a859f23db8c2d7e1c6524f9050
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For historic reasons, the test had a single list of override xml files
to copy first into the global dir, and then into the local dir.
But glob-deleteall only makes sense in the local dir (as per the MIME
spec). Having two definitions for the same mimetype in the same dir
is undefined behavior, so the test was working by chance only, and
my upcoming refactoring/fixes caught that.
Change-Id: I4717683b4b3f9ba69f1fd815669460789700e877
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since compilers don't provide such macros, do it ourselves.
In order to test these macros, add ad-hoc specializations of
QTest::toString() for qint128 and quint128 locally to the test. Turns
out it's not too hard to write them, so we might move them to a public
header, yet.
Pick-to: 6.6
Change-Id: I1483f3af2ccec6038e1c780649f9ffe413bb59ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check that QIntegerForSize<16> and std::numeric_limits<quint128> work
and that q(u)int128 are available in C mode, too.
Pick-to: 6.6
Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There were two problems:
- On platforms where QFLOAT16_IS_NATIVE == true, a qHash(qfloat16{})
call has become ambiguous between the three FP qHash() overloads
(float, double, long double), where it was unambiguously calling the
float one in Qt 6.4. This SiC was caused by the replacement of
operator float() by operator __fp16() in
99c7f0419e, which is in Qt 6.5.
- On platforms where QFLOAT16_IS_NATIVE == false, qHash(qfloat16{})
would produce a different value from qHash(float{}), and therefore
Qt 6.4, when the seed was != 0, because the former would go via the
one-arg-to-two-arg qHash adapter while the latter one would
not. Since participating functions are inline, this causes old and
new code to produce different hash values for the same qfloat16,
leading to a BiC possibly corrupting QHash etc.
Fix both by adding an explicit qHash(qfloat16). This function is
inline, so it doesn't add a new symbol to 6.5.x.
[ChangeLog][QtCore] Fixed qHash(qfloat16) which was broken from 6.5.0
to 6.5.3, inclusive. If you compiled against one of the affected Qt
versions, you need to recompile against either Qt 6.4 or earlier or
6.5.4 or later, because the problematic code is inline.
Pick-to: 6.6 6.5
Fixes: QTBUG-116064
Fixes: QTBUG-116076
Change-Id: Id02bc29a6c3ec463352f4bef314c040369081e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QWindow::setMask() is not guaranteed to turn the masked out areas
transparent, and it's up to the client to ensure this during
painting.
Pick-to: 6.6
Change-Id: I1155b3ad095152a993532f2290cacb670e20daa7
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The event might come from a partial expose, but we want to
fill the entire bounds of the window, as we're filling with
a gradient.
Pick-to: 6.6
Change-Id: I66cedb160fb0ed06935c06ba2fe5dec9ed468833
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Visualize what's going on with tst_QTextCursor::insertMarkdown() at least.
But this could be expanded for other purposes.
It's also interesting to test drag-and-drop with this. And you can save
the result to any supported text format.
Change-Id: I363c32ff9b1bd7c53c562b08c58de95a69be0aa9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
0b421fa58b9a73d657bf17834788fd1175c4767e ensured a correct focus chain,
when buttons in a QDialogButtonBox were hidden.
The implementation did not check, if a hidden button was added via
setStandardButtons(). In consequence, it was removed from the
standardButtonHash and never added again.
QDialogButtonBox::button() returned nullptr for a standard button,
once it had been hidden. That introduced a regression.
This follow-up patch makes sure, a standard button is not removed
from standardButtonHash, when hidden. By no longer removing it from
standardButtonHash, it makes showQDialogButtonBox::button() always
return the pointer to the standard button, even if it is hidden.
The function handleButtonDestroyed() used the argument
QDialogButtonBoxPrivate::RemoveRule::KeepConnections, in order to leave
signal/slot connections untouched. It expected the the destroyed button
to be removed from standardButtonHash. In order to retain that
functionality, the enum class RemoveRule is renamed to RemoveReason,
and one value was added. QDialogButtonBoxPrivate now handles all
necessary cases of removing a button:
ManualRemove (previously Disconnect):
- remove button from roles
- remove button from standardButtonHash
- disconnect all signals
LeaveEvent (previously KeepConnections):
- remove button from roles
- do not remove button form standardButtonHash
- do not disconnect signals
Destroyed (new):
- remove button from roles
- remove button from standardButtonHash
- do not disconnect signals (QObject will do that)
An autotest is added to tst_QDialogButtonBox.
Task-number: QTBUG-114377
Pick-to: 6.6 6.5
Change-Id: Ib28625d44fa89c3d06f181f64875c2e456cebbfa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
By first checking if the list has any matches before potentially making
it detach.
Change-Id: I7a42c2910ef6efc45033e562573414a3a9ef972e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
91dcc76fc1 might have fixed the underlying issue, so we no longer
need the XFAIL codepath at all.
Fixes: QTBUG-114720
Change-Id: I67ccbed67a0536b679c50c26eb0b3e51c93dceeb
Pick-to: 6.6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
rowsAboutToBeMoved() and rowsMoved() signals aren't emitted for
QSortFilterProxyModel, which meant the two connections in the
ObservingObject's constructor didn't trigger the slots, which let the
test pass (the store/checkPersistentFailureCount stayed at 0).
- Instead connect to layoutAboutToBeChanged() and layoutChanged()
respectively, these two are emitted for QSFPM
- Use PMF syntax
- Verify m_persistent{Proxy,Source}Indexes aren't empty
Change-Id: I8b83989de02c2bfb22bde9b230cb5b68814f74b6
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Because the local `seed` variable shadowed the member one, this test
was run for each QFETCH_GLOBAL with the same data and seed. That
doesn't make sense, so make the test use the member variable `seed`,
as all other tests already do.
Since zero is one of the seeds coming from QFETCH_GLOBAL, drop the
seedless calls to qHash(), too.
Amends 64bfc927b0.
Pick-to: 6.6 6.5 6.2
Change-Id: I1e22ec0b38341264bcf2d5c26146cbbcab6e0749
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old code only tested with seed = 0 and seed = 1045982819, the
latter being a "random number", which, however, fits into
32-bits. Since Qt 6.0 increased the seed from uint to size_t, amend
the test to actually test a seed value with some of the upper half of
bits set, too, also in 64-bit mode.
While we're at it, also test with each seed's bits flipped for extra
coverage.
Remove a static assertion that prevented testing seeds with the MSB
set.
Pick-to: 6.6 6.5 6.2
Change-Id: I5ed6ffb5cabaaead0eb9c01f994d15dcbc622509
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit reverts 2d77051f9d.
When requesting an allocation of size 0, we will actually get
a nullptr.
qarraydata.cpp:
~~~
if (capacity == 0) {
*dptr = nullptr;
return nullptr;
}
This will let the Q_CHECK_PTR trigger falsely. Such an occurrence was
initially detected during the cmake_automoc_parser build-step.
Found-by: Marc Mutz <marc.mutz@qt.io>
Task-number: QTBUG-106196
Pick-to: 6.6
Change-Id: Icb68c5dd518c9623119a61d5c4fdcff43dc4ac5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QStaticLatin1StringMatcher is a static templated Latin-1 Boyer-Moore
string matcher which can be case sensitive or not. It should be used
when the needle is known at compile time so there is no run-time
overhead when generating the skip table.
The convenience functions qMakeStaticCaseSensitiveLatin1StringMatcher
and qMakeStaticCaseInsensitiveLatin1StringMatcher should be used to
construct the matcher objects.
Green Hills Optimizing Compilers are currently not supported.
[ChangeLog][QtCore] Added QStaticLatin1StringMatcher, which can be used
to create a static constexpr string matcher for Latin-1 content.
Task-number: QTBUG-100236
Change-Id: I8b8eed1e88e152f29cbf8d36d83e410fafc5ca2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The latest XDG spec (0.8) defines XDG_STATE_HOME that does not exist
in QStandardPaths::StandardLocation.
Some Linux distributions clean XDG_CACHE_HOME on restart which makes
XDG_STATE_HOME useful as a path for saving application state.
This commit adds StateLocation and GenericStateLocation to serve as a
StandardLocation for XDG_STATE_HOME for all platforms.
This commit also updates docs and tests to fit the new changes.
[ChangeLog][QStandardPaths] Added StateLocation &
GenericStateLocation to StandardLocation
Change-Id: I470602466c37f085062cc64d15ea243711728fa5
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QWidget::setVisible is virtual, and called via hide() by both the
QDialog and the QWidget destructor. A dialog that becomes invisible
when getting destroyed will at most execute the QDialog override.
Subclassing QDialog and overriding setVisible() to update the state
of the native platform dialog will not work, unless we explicitly
call hide() in the respective subclass's destructor.
Since e0bb9e81ab, QDialogPrivate::setVisible is
also virtual, and gets called by QDialog::setVisible. So the clean
solution is to move the implementation of the native dialog status
update into an override of QDialogPrivate::setVisible.
Add test that verifies that the transient parent of the dialog
becomes inactive when the (native) dialog shows (and skip if that
fails), and then becomes active again when the (native) dialog is
closed through the destructor of the Q*Dialog class. The test of
QFileDialog has to be skipped on Android for the same reason as the
widgetlessNativeDialog.
Fixes: QTBUG-116277
Pick-to: 6.6 6.5
Change-Id: Ie3f93980d8653b8d933bf70aac3ef90de606f0ef
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This allows us to control whether to run this particular test in ASan
mode or with specific loggers or not. Adding the expected log output for
tst_silent for other loggers is left as an exercise to the reader.
Change-Id: Ifa1111900d6945ea8e05fffd177f1548c8c8e714
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This reverts commit f20adcde30. The
implementation had the right idea, but this is not expected to work
reliably in C++. It's jumping out of several frames without cleaning
them out properly and our ASan-based memory leak-checker has started
complaining (the next commit will move this test elsewhere).
==19313==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 258 byte(s) in 1 object(s) allocated from:
#0 0x7ffa505c8e48 in __interceptor_malloc (/usr/lib64/libasan.so.5+0x109e48)
#1 0x7ffa4f2d7ff9 (/home/qt/work/install/lib/libQt6Core.so.6+0x896ff9)
#2 0x7ffa4f2d834d in QArrayData::allocate(QArrayData**, long long, long long, long long, QArrayData::AllocationOption) (/home/qt/work/install/lib/libQt6Core.so.6+0x89734d)
#3 0x7ffa4f23b700 (/home/qt/work/install/lib/libQt6Core.so.6+0x7fa700)
#4 0x7ffa4f1f6cc8 in QString::reallocData(long long, QArrayData::AllocationOption) (/home/qt/work/install/lib/libQt6Core.so.6+0x7b5cc8)
#5 0x7ffa4f1f68a7 in QString::resize(long long) (/home/qt/work/install/lib/libQt6Core.so.6+0x7b58a7)
#6 0x7ffa4f2092ff (/home/qt/work/install/lib/libQt6Core.so.6+0x7c82ff)
#7 0x7ffa4f209e09 in QString::vasprintf(char const*, __va_list_tag*) (/home/qt/work/install/lib/libQt6Core.so.6+0x7c8e09)
#8 0x7ffa4ed0d83d (/home/qt/work/install/lib/libQt6Core.so.6+0x2cc83d)
#9 0x7ffa4ed114a9 in QMessageLogger::fatal(char const*, ...) const (/home/qt/work/install/lib/libQt6Core.so.6+0x2d04a9)
#10 0x5641d2604c40 in tst_Silent::messages() /home/qt/work/qt/qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp:77
#11 0x5641d26050fb in tst_Silent::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) tests/auto/testlib/selftests/silent/silent_autogen/include/tst_silent.moc:118
The restoration of the signal handler (which QtTest now has) is also
wrong: this needed to use sigaction() instead.
Change-Id: Ifa1111900d6945ea8e05fffd177f14fbc09a1d7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Nothing in those files uses QPair; and a local build finished fine without them.
Task-number: QTBUG-115841
Change-Id: I669cfecaa9129bce6b31e464826287f138b159db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In order to test the impact of migration to QASV.
Task-number: QTBUG-101707
Pick-to: 6.6 6.5 6.2
Change-Id: I17f84ca98fc87d89bb4cd6ad98c8a12aecd315ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a change-of-zone manual test, based on a bug-report by Felix
Kälberer. This failed: debugging revealed that MS's mktime() doesn't
pick up a change to system zone.
Fixes: QTBUG-83881
Change-Id: I9b86398ef870627a059e269f85a0f5d9d9de284b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The test case is an incomplete version of the test that will be added to
verify the fix for the referenced bug report. The test crashes already
when showing the dialog without this fix.
Task-number: QTBUG-116277
Pick-to: 6.6 6.5 6.2
Change-Id: I969a723157f6453b78bafae5cb24a6b37b1eea50
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
... to replace the old stateChanged(int) one, which a) had the wrong
name and b) the wrong argument type.
Mark the old one as \obsolete, so new users don't see it
anymore. Prepare for deprecation in the test, but don't actually
deprecate, yet (this author does not know how to deprecate signals).
Found in API-review.
Amends 37b47ebf94.
As a drive-by, replace explicit qWait() calls with QTRY_COMPARE().
[ChangeLog][QtWidgets][QCheckBox] Added new
checkStateChanged(Qt::CheckState) signal, obsoleting
stateChanged(int).
Fixes: QTBUG-104688
Change-Id: I01791fd003b752c47d99bea65151202be9175c21
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The palette set by windows vista style during polish doesn't allow style-
sheet style to override it.
This patch reset resolve mask for the palette set by windows vista style
and thus it can be overridden.
Fixes: QTBUG-115511
Pick-to: 6.6 6.5
Change-Id: Ifcaf441f806cfa0273599b3dce83fdfaec3f5a66
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
There was an extra `q` before dnslookup.
Found while trying to build tst_qdnslookup, the target wasn't seen by
CMake/Ninja.
Pick-to: 6.6
Change-Id: Id594aab30dc9081fc269541561e0f2db5e615657
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
See code review 496440 on Gerrit for the details.
Change-Id: Ibd32a44cf7e2e07f36687cc2f0eeaf3008f64e73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
By saying what's special about some of them
Pick-to: 6.6 6.5
Change-Id: I17bf2e12a27bf55f621020ddf3819ee9e606847d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of adding it after the block size was calculated. This makes no
difference for non-growing (exact) blocks. For growing blocks, this
means we take that extra element into account before rounding to the
next power of two, instead of after. That results in a change of the
thresholds of when a block grows and also what capacity it will
contain.
For example, for a QString growing to 22-25 elements:
Request | Previously | Now |
elements | bytes | malloc()ed | capacity() | malloc()ed | capacity() |
22 | 44 | 66 | 24 | 64 | 23 |
23 | 46 | 66 | 24 | 64 | 23 |
24 | 48 | 66 | 24 | 128 | 55 |
25 | 50 | 130 | 56 | 128 | 55 |
To avoid wasting elementSize - 2 bytes in this footer, we only include
this footer if elementSize <= 2. Thus, for a QList<int> growing to 11-13
elements:
Request | Previously | Now |
elements | bytes | malloc()ed | capacity() | malloc()ed | capacity() |
11 | 44 | 66 | 12 | 64 | 12 |
12 | 48 | 66 | 12 | 128 | 28 |
13 | 52 | 130 | 28 | 128 | 28 |
In both cases, we now only allocate powers of two while growing, which
may be beneficial to some allocators.
Pick-to: 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177dcb96e251d0a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The SizeShift was not taken into account when constructing QASV from
QL1SV. This is not an issue in normal Qt builds, because SizeShift == 0
there.
But in bootstrapped case (and in future Qt 7) SizeShift changes to 2,
and the bug becomes visible.
The added test-cases do not really reveal the issue, because we do
not run tests in bootstrapped builds, but at least they will help
to prevent the issues in Qt 7.
Pick-to: 6.6 6.5 6.2
Change-Id: I337b37b5230323a5357f48fd1c9bf799ca507d52
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The pre-existing test for QLocalServer was testing only a minor subset
of cases, so replace it with the call to
QTestPrivate::testReadWritePropertyBasics.
The test for QLocalSocket's bindable properties was missing, so add
it.
The new tests didn't reveal any problems.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I695bb050d39eeae9ffb84c097c36601a4ca89af6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.
The updated test didn't reveal any problems with binding loops, so no
other action is required for now.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I51a17974a7f5bec3c969fcb55b6f28e3e9218eb5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.
The updated test didn't reveal any problems with binding loops, so no
other action is required for now.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I360614a40fe2bacb796051607ed67e7e666b4f22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The bindable property tests were not using the QTestPrivate helpers, so
add a new test which uses them.
The new tests revealed a binding loop for the interval property.
Fix it in a usual way by explicitly removing the binding and using
{set}ValueBypassingBindings() in the setter.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: If94f57938da449a68e3527aead5ebd55ba410adb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The old tests were not using the test methods from QTestPrivate, so
add another test case.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I291ede26461e79a615630f1decad2ad7549b4dd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
... by using valueBypassingBindings() when accessing the properties
from the setters.
This commit is mostly trivial.
Had to change the template parameters in the unit-test, because the
updated QTestPrivate::testReadWritePropertyBasics() creates an instance
of the TestedClass, and QAbstractProxyModel cannot be instantiated,
since it has pure virtual methods.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I0cae29263ea9bb92c9de06891b0ba8633fb9fd72
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The bindable property tests should use the helper functions from
QTestPrivate.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: Ie1a61ab80e6f737eac02246214c2c93129a1cf94
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Extend the unit-tests for bindable properties and fix the discovered
binding loop by using {set}ValueBypassingBindings() in the setter of
the duration property.
The code refactoring does not modify the setter logic, because
previously the binding was anyway implicitly removed when calling the
assignment operator. The updated code just does it explicitly.
Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: I0f339d182efb60500ee7f12e407f200d739da312
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
libstdc++'s std::filesystem::path implementation incorrectly assumes
that any 8-bit char input is UTF-8, when it patently isn't on Windows.
Reported at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111244
Pick-to: 6.5 6.6
Fixes: QTBUG-116609
Change-Id: I2b24e1d3cad44897906efffd17803f2862935c9b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It's very hard to debug a macro.
Pick-to: 6.5 6.6
Change-Id: I2b24e1d3cad44897906efffd17803b8eac9bd844
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Accessibility implementations rely on correct information about the
model dimensions when operating on item views. An item view that has a
root index set needs to report it's size based on the root index, rather
than for the view's model directly.
Pass the rootIndex to all calls to QAbstractItemModel::column/rowCount.
Refactor the code to avoid excessive dereferencing of a QPointer, apply
const and fix/improve coding style in touched lines.
Emit a ModelReset notification when the root index changes, or (in the
case of QListView) when the model column changes.
Split long Q_ASSERTs into multiple lines to be able to better trace the
exact reason for an assertion, and replace the assert with an early
return of nil when it's plausible that a cached cell is no longer part
of the view (i.e. because the root index changed).
Add a test case that verifies that changing the root index changes the
dimension of the view as reported through the accessibility interface.
Pick-to: 6.6 6.5
Fixes: QTBUG-114423
Change-Id: I7897b79b2e1d10c789cc866b7f5c5dabdabe6770
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Installing a second mimetype with *.txt as glob had a different
effect depending on whether it was installed into the same prefix
or a different prefix as the one where text/plain is installed.
Pick-to: 6.6
Change-Id: I7f54b8efe22f620eb57257745c48fe5402c87626
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QTextMarkdownImporter::import() took a QTD* as if it would be ok to
reuse one instance of QTextMarkdownImporter for repeated importing into
different documents; but in practice, we never do that: in fact it's
usually a short-lived, stack-allocated object, as in
QTextMarkdownImporter(&doc, QTMI::DialectGitHub).import(input);
So it's less clumsy internally to require the document be provided to
the constructor: that way a QTextCursor can be constructed immediately
too, as part of the importer object rather than separately on the heap.
This is private API, unused outside qtbase.
Change-Id: I8041ceb33cb7e7608df55dc5a963292c585afb90
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The 6.5 versions of the overload not taking a context/receiver object
were constrained by requiring a functor to be free function or lambda.
207aae5560 removed that constraint, which
might be source incomaptible if wrapper functions in user code forward
the constraint using Expression SFINAE. Those wrappers would no longer
be removed from the overload set based on the same criteria as the
function they wrap.
We can't constrain the new functions based on the same predicate as
before, as after the simplification we have only one overload with, and
one without context object. But we can still remove overloads for
incompatible functors.
Add the respective scenario to the QPermission test as a compile-time
test.
Found during 6.6 header review.
Pick-to: 6.6
Change-Id: Id21391b4a6b78a29de2f8fa04374f4262e5fafa7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
...to set m_o to nullptr and prevent an existing QSignalBlocker from
touching the QObject, which it was created for.
Add documentation and implement an autotest.
Change-Id: Ic18e80af5a57df1928f9d36aa0ab7ad79b6525fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Private libraries were linked conditional to QT_FEATURE_private_tests in
the CMake file. qstatictext_p.h was included conditional to developer
build. A developer build fails, with test enabled and private tests
disabled.
=> Change the CMake condition to QT_FEATURE_developer_build, to resolve
mismatch between CMake and cpp file.
Pick-to: 6.6 6.5 6.2
Change-Id: I79213e7d3c38851b8b80cb8ab248d7bff750c227
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
QLabel *l is declared uninitialized, assigned in a for loop. The last
object is deleted for testing purposes.
This leads to a false compiler warning about deleting a potentially
unintialized pointer.
=> initialize with nullptr to silence the warning.
Pick-to: 6.5 6.6
Change-Id: I1422b04fc1fdbfc7248de577884aabfb539f3f4b
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Private libraries and WrapOpenSSL were linked conditional to
QT_FEATURE_private_tests in the CMake file.
qsslkey_p.h and open ssl symbols were included conditional to developer
build. A developer build fails, with test enabled and private tests
disabled.
=> Change the CMake condition to QT_FEATURE_developer_build, to resolve
mismatch between CMake and cpp file.
Pick-to: 6.6 6.5
Change-Id: I3ac93b02701e467a0b548c35d441d35a45c4568b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
QItemSelectionModelPrivate::initModel() uses string based connections,
to connect/disconnet its QAbstractItemModel.
The QObject::destroyed signal is connected to modelDestroyed(), which
does not disconnect other signals.
QQuickTableView's selection model binds to its QAbstractItemModel.
The binding also reacts to QObject::destroyed
Eventually, QItemSelectionModel::setModel(nullptr) is called.
At this point, only a QOBject is left from the QAbstractItemModel.
That leads to warnings about disconnecting string based signals, which
belong to QAbstractItemModel.
This patch changes the connect syntax to the QObjectPrivate::connect
API. Instead of keeping a list of string based connections around, the
connections themselves are kept in a list member. Disconnecting happens
based on that list.
Connections are also disconnected in
QAbstractItemModelPrivate::modelDestroyed.
An auto test is added in tst_QItemSelectionModel.
Fixes: QTBUG-116056
Pick-to: 6.6 6.5 6.2
Change-Id: I57e5c0f0a574f154eb312a282003774dd0613dd6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This functionality was lost when we switched to Catch2.
Change-Id: I2b24e1d3cad44897906efffd177fb4cff641546f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Amends 118f2210c6. That commit added
#ifdef Q_OS_UNIX
if (test == "assert"
|| test == "crashes"
|| test == "failfetchtype"
|| test == "faildatatype")
return; // Outputs "Received signal 6 (SIGABRT)"
#endif
Which duplicated 4 out of the 5 tests in the block:
#ifdef Q_OS_LINUX
// QEMU outputs to stderr about uncaught signals
if (QTestPrivate::isRunningArmOnX86() &&
(test == "assert"
|| test == "crashes"
|| test == "faildatatype"
|| test == "failfetchtype"
|| test == "silent"
))
return;
#endif
But as Linux is Unix, we never got to that second block for those 4
tests.
Pick-to: 6.6
Change-Id: I2b24e1d3cad44897906efffd177fb4b5507d190a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QString::fromJsString -> QString::fromEcmaString()
QString::toJsString() -> QString::toEcmaString()
For API naming compatibility with QByteArray::fromEcmaUin8Array()
Pick-to: 6.6
Change-Id: If6e2121e31e630d6728ed24e41d14b763f395aaa
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
QWidget already handles this, but it might be useful for non-Widget
object hierarchies as well, such as in Qt Quick.
The flag is opt in, and as QWidget already handles these events by
itself (without checking any flags), we assert that we don't end up
in this code path, instead of enabling it for QWidget. The latter
would mean refactoring the QWidget code, with possible regressions.
Docs and header comments have been updated to reflect that this
event is not widget specific. (This is an issue with other events
as well, that are documented to say "widget", since they came
from a time when there was only QWidget, but nowadays apply to
e.g. QWindow as well. That's something for another fix though).
Change-Id: Ib71962131d6011c17dcce8c01bd8adcdaa58d798
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
OpenSSL 3.1.2 can be configured with no-deprecated option, in this
case test fails to build.
Pick-to: 6.6 6.5 6.2
Change-Id: Icaf457f55fb001b632922856dbe4bbb5bdba220e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It's currently conditional on two features used in QNetworkInterface.
The fact that QNetworkInterface misses those two features is probably
correlated to the failures observed on QNX, but is not the cause, so
this code was actually wrong and was possibly disabling the execution of
similar content on other OSes.
Therefore, this commit removes them and changes the conditional to
exclude the OS that is failing (QNX).
I find this situation unacceptable. IPv6 support is mandatory for any
application after 2011-01-31, the date when IANA delegated its last IP
block, and definitely after 2019-11-25, when RIPE NCC ran completely
out. But since there's no SDK available for it, I'll grudgingly accept a
grandfathered exception because there's nothing I can do about it (I
tried to fix it; look at the change history of this patch set). I will
block any new OSes in that situation, though.
Task-number: QTBUG-116503
Change-Id: Ifa1111900d6945ea8e05fffd177ed6979c3e5916
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Let's do it in initTestCase(), where we're already searching for IPv6
addresses, instead of storing the information in a local static.
Pick-to: 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177efb6a055aaa58
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This was disabled in d0d1d74033, I guess
accidentally, by a too-wide conditional. The change the same commit
applied to QtNetworkSettings didn't make the same mistake.
I am also opportunistically updating the conditional to QT_CONFIG (I
missed this in 9d4579c1cd) and adding the
Linux-specific check, as the AF_NETLINK implementation does not rely on
getifaddrs() or if_nametoindex().
Drive-by fix indentation.
Pick-to: 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177ef8fcb11b4e1e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This involves reimplementing QWidgetPrivate::grabFramebuffer().
Widgets call this function whenever a texture-based widget is
encountered.
This implies however that we rename QRhiWidget's own, lightweight
grab function, grab(), because it kind of shadows QWidget's grab().
Switch back to grabFramebuffer() which is what QQuickWidget and
QOpenGLWidget both use.
Supporting QWidget::grab() is particularly important when grabbing
an ancestor of the QRhiWidget, because that has no alternative.
Right now, due to not reimplementing the QWidgetPrivate function,
the place of the QRhiWidget is left empty.
In addition, grabFramebuffer() is now const. This is consistent
with QQuickWidget, but not with QOpenGLWidget and QOpenGLWindow.
Change-Id: I646bd920dab7ba50415dd7ee6b63a209f5673e8f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
localStorage is unavailable on workers. Operations will now get proxied
to the main thread instead.
This - among other benefits - makes tst_QSettings::testThreadSafety
pass.
Task-number: QTBUG-115509
Change-Id: Iebbe5e9f9069948f8728e0a82628cc082b30de12
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
We know that all lines from /proc/<PID>/maps end in a newline, so we
trim exactly that one byte, then we put it all back together with
.join('\n') to check if we've read the entire file.
Linux virtual files are usually served in 4 kB increments; tst_qfile's
maps file is about 16000 bytes for me, just short of the QIODevice buffer:
[pid 414315] read(5, "55c6afe04000-55c6afe11000 r--p 0"..., 16384) = 4049
[pid 414315] read(5, "7f215fd25000-7f215fd26000 r--p 0"..., 12335) = 4038
[pid 414315] read(5, "7f2160800000-7f21608c7000 r--p 0"..., 8297) = 4072
[pid 414315] read(5, "7f216119f000-7f21611a0000 rw-p 0"..., 4225) = 3994
It is not a coincidence that the reads are at line boundaries, though
it's not a guarantee from the kernel.
We appear to have accidentally fixed the QEMU emulation bug by reading
another process' /proc/<PID>/maps (hypothesis: QMU emulates the target
system in /proc/self, hiding itself in maps, but makes no translation
for other process map files.
Change-Id: Ifbf974a4d10745b099b1fffd1777ac919b12dc90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The test changes couple variables to emulate the user project
environment. These variables also affect the policy handling.
The test will build and work properly only if tests are built
standalone. So add this limitation.
Amends 2e340cea88
Pick-to: 6.6
Change-Id: I0cc49bf55bf7763e4c3ecdfa5333fb0453f06794
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We are BLACKLISTing on macos/arm - the test is flaky.
Pick-to: 6.6 6.5
Task-number: QTBUG-115945
Change-Id: I3be28c895d46ce5ba86e00d597016334bdb16021
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
QObject::children() returns a const QList&, and nothing in the loop body
changes the objects children, so straightforward port to ranged-for.
Task-number: QTBUG-115839
Change-Id: I78827fd986d6ff2607cc2616ff23580c9d830f1b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
It's very flakey in CI: http://testresults.qt.io/grafana/goto/XZQAAPRSg
What we want to test is whether Qt issues paint events in response
to enabling an already enabled effect. Doing so via qWait will process
both window system events and posted Qt events, and the former might
include spontaneous paint events from the system that we can't control.
Task-number: QTBUG-115945
Pick-to: 6.5 6.6
Change-Id: I65e5c6a4458e77b3bd2ad700c5caf6d441f4ca53
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Neither fork() nor execvp exist on Vxworks so they should not be used
Task-number: QTBUG-115777
Change-Id: I6de4e9ec67741466de1b1f4bd89d9c962e539bb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Due to the pre-existing overload of invokeMethod that accepts a void-pointer there is
concern that the new overloads would not be preferred.
Here we add a test for this to verify all supported platforms work.
Change-Id: Ie5ac7bf16643599006ac57e0145feb6aace3fa87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This was missing for a while, and there is nothing fundamentally
missing for it to work.
With the more recent work around slot objects and invokeMethod in
general, it is a good time to add support for this.
In this patch, when connecting to a functor, it automatically deduces
the overload to call based on the arguments passed to invokeMethod.
Sharing code with QObject::connect could be done, but they have a
key difference that makes it harder:
With signal emissions we throw away trailing arguments that are not
used: i.e. `signal(int, int)` can be connected to `slot(int)` or
`slot()`. With invokeMethod that's not a thing. So we will need a way
to toggle that behavior during resolution.
[ChangeLog][QtCore][QMetaObject] Added support for passing parameters
to the overload of QMetaObject::invokeMethod that takes a functor. These
new overloads must have the return-value passed through qReturnArg().
Change-Id: If4fcbb75515b19e72fab80115c109efa37e6626e
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Tests in non-qtbase modules could not find_package their own Qt6*Tools
packages, because add_subdirectory(tests) was called before the config
files for Qt6*Tools were created.
The creation of tools config files is done in QtPostProcess.cmake, which
was included in qt_build_repo_end(). Move that include into its own
macro, qt_build_repo_post_process() and remove it from
qt_build_repo_end(). Call qt_build_repo_post_process() before the
'tests' directory is added in qt_build_repo().
Every call site of qt_build_repo_end() must now be adjusted and call
qt_build_repo_post_process().
Task-number: QTBUG-88264
Change-Id: I80d60a1b5c0e9b715c298ef4934b562f815432d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qt6_android_generate_deployment_settings is implicitly used by
qt6_add_executable in user projects. This test makes sure that the
function behaves as expected for user projects specificly, since in Qt
tests it behaves differently because of Qt-specific conditions inside.
Task-number: QTBUG-116037
Pick-to: 6.6
Change-Id: Iea10eca7a780ebaff0c05b91ebe47b821b9ec956
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Remove all "#undef QT_NO_FOREACH" white-listing from source files.
Previous commits have removed all remaining Q_FOREACH/foreach uses in
this sub-tree.
Also remove one source file from NO_PCH_SOURCES in CMakeLists.txt.
Task-number: QTBUG-115839
Change-Id: I02cf994eda720c028e613407342fbd6658fa62b1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The QHash "cache" isn't modified in the loop body (method is const), in
general cacheSize() shouldn't be susceptible to data races.
Task-number: QTBUG-115839
Change-Id: I122a03ddd5e648d16736c16fa9289eafc886979d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The toString() method's parameter is a const&, the loop body doesn't
change the container; and the container the parameter refers to isn't
changed during iteration.
Drive-by, remove braces from single-line if blocks.
Task-number: QTBUG-115839
Change-Id: I363e1ed37c0f75fa6a9f8eac3393a6c10d756c1b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Straightforward ports where the container could be made const.
Use C arrays instead of QList if the data is known at compile time.
Drive-by, where appropriate make the for-loop variable a const& (e.g.
QString) instead of copying it for no reason.
Task-number: QTBUG-115839
Change-Id: I273a386e414e5923e750072f0407226efcd4531e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
In both cases, the container is a member of the unittest, initialized in
initTestCase(), then not changed after that. So use std::as_const.
Task-number: QTBUG-115839
Change-Id: I3b66127e10ac94137260d99f354de9f66a74bec7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The containers are created locally in the top level test functions, they
can't be made const due to the way they are filled, however the loop
body don't change them; even if the code in a loop would cause
re-entrance du due to signal emittance or events processing, those
containers aren't affected and aren't changed during iteration because
the top-level test functions themselves aren't re-entered, hence
use std::as_const.
Drive-by change: take QHostAddress by const& when it's used as a
for-loop variable (it has a QExplicitlySharedDataPointer d-pointer).
Task-number: QTBUG-115839
Change-Id: I443169e10d973aba2f62854aba200fc2dc2c80aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The loops were iterating over a temporary, so use a local const auto
variable to hold it, and use ranged-for.
Drive-by, make the for-loop variable const& instead of copying it,
for any object that has a d-pointer (QNetworkAddressEntry, QHostAddress,
QNetworkInterface).
Task-number: QTBUG-115839
Change-Id: If96c0b2a6142fe2fa2ed45ed7e2435cc1f80e005
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The was introduced with the rewrite of QMetaObject::invokeMethod() in
commit 0f76e55bc4, because we have an
optimization for zero timers to avoid creating a temporary
QSingleShotTimer object. The old implementation did attempt to normalize
the target slot name, but did so because it looked metamethods up using
QMetaObject::indexOfMethod:
int idx = meta->indexOfMethod(sig.constData());
if (idx < 0) {
QByteArray norm =
QMetaObject::normalizedSignature(sig.constData());
idx = meta->indexOfMethod(norm.constData());
}
The new implementation does not use this method so it didn't need to
attempt to normalize.
I am fixing this only in QTimer and not in QMetaObject::invokeMethodImpl
(even though it is trivial to do so) because I don't believe spaces in a
pure string to invokeMethod were ever expected to work:
QMetaObject::invokeMethod(obj, "slotName ", Qt::QueuedConnection);
The Q_ARG and Q_RETURN_ARG (for code not recompiled) still does
normalization inside QMetaType::fromName().
Fixes: QTBUG-116060
Pick-to: 6.5 6.6
Change-Id: I964c2b1e6b834feb9710fffd177cac60c83ef413
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>