Makes it easier to pull out data from a document when the structure is
known up front, while still supporting default values if the structure
does not match the expectation, eg:
int age = QJsonDocument::fromJson(ba)["users"][0]["age"].toInt(-1);
Change-Id: Ief0899bbb81610f6f22a56e2ac846121bffe77a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Saves a lot of manual toArray() and toObject() calls when the
JSON structure is usually known anyways. Read only access for now.
Change-Id: I5fd787144198e0443e4da285a11ce2597b66f99f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
As QAbstractSocket::readData does and as the documentation of QIODevice says
"this function returns -1 in those cases (that is, reading on a closed
socket..."
Change-Id: I1e64673f6a6d792a640bd6cb28b2bb5a0f18dc36
Reviewed-by: Aleix Pol
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Adds a function to return the native socket descriptor. It allows
threaded or forked applications to reuse a previously created socket.
[ChangeLog][QtNetwork][QLocalServer] Added a function to retrieve
the socket descriptor.
Task-number: QTBUG-55043
Change-Id: I556e97000d2c02ad2bdd636984de6c7564381c6a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This class in unused in qtbase since Qt 5.6.1.
The only outside usage was in qtserialport, which got its own copy of
QWinOverlappedIoNotifier in commit qtserialport/65dba188.
Change-Id: I7668e67a1cc49c4418c66141784b180cd5f9d479
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
It's the subdir where the implementation also lives. There's no
src/widgets/gestures, either.
Change the mac: into a darwin: scope in the .pro file, so Sanity Bot
does not complain.
Change-Id: I7608d6da05af4a1117db585798a87a20ae80717a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Add additional code paths to map the index passed by QCompleter in its
activated() signal in case when QCompleter's model isn't the same as
QComboBox's one.
Task-number: QTBUG-52027
Change-Id: I1d74037fccbe19962bb7f242aa7b1c2441aa5d54
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Similar on how it is done for Windows desktop we also use the given
style hint when building the list of fallbacks a font family.
Change-Id: I71378581d07f20ebe5bf0bc757bba919cc70e118
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
The documentation says that it's equivalent to
qgetenv(varName).toInt()
But the implementation wasn't. QByteArray::toInt() verifies that the
entire string was consumed, so QByteArray("1a").toInt() == 0, but
qstrtoll alone doesn't. That is, qstrtoll("1a", ...) == 1.
The implementation also detected the base, a behavior I kept. Instead, I
updated the documentation.
Change-Id: I0031aa609e714ae983c3fffd14676ea6061a9268
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This method now returns -1 by default, due to commit 6255cb893d
which mistakenly replaced -1 with Qt::IgnoreAction (0x0).
As a result, dropping is forbidden in a number of applications
(I detected this in zanshin).
Change-Id: I4922451216e08d5d3fe36f8ba87364a361b691bf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
A number of drawing paths were never tested by lancelot because we
always used argb32pm for subsurfaces. This patch switches the
subsurfaces to use the painter format or its alpha version. This means
changes to composition tests as it changes precision, especially of
alpha in the a2rgb30 formats.
Change-Id: I24d53bf6e1db8cca36bda69e2ddf07f20256b3c8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
tryAcquireWithTimeout(0.2s) was already blacklisted and
now the same failed with "(2s)".
Task-number: QTBUG-58745
Change-Id: I82363238c08056d2969a7616e3a6e5af080d537d
Reviewed-by: Liang Qi <liang.qi@qt.io>
We have to use a temporary data path for winrt, as the applications
are sandboxed and cannot just put data anywhere.
Change-Id: I8f95de132e5b5ac77441cbbf26af873b8018c7cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
In the referenced bug report, dismissing a QFileDialog while the
Qt Virtual Keyboard was in use would result in a crash.
Dismissing a file dialog created with
e.g. QFileDialog::getOpenFileName() causes it to eventually be
destroyed. When this happens, it starts deleting its children. Each
child widget's destructor calls clearFocus(). In clearFocus(), there is
a block of code that emits QWindow::focusChanged(), passing the result
of focusObject() called on that widget's window.
QWidgetWindow::focusObject() could end up using itself as a fallback
focus object if it had no other focus objects (e.g. children) to use
instead, even though it was in the process of being destroyed; as were
all of its children. The Qt Virtual Keyboard plugin would then try to
use the focus object, even though it was in an invalid state.
To fix this problem, we return early from QWidgetWindow::focusObject()
if the window is in the process of being destroyed.
Task-number: QTBUG-57193
Change-Id: I137cf9415812ce2e0419c0afe8076ce150f248cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This makes the test a lot faster and perhaps more reliable.
Change-Id: I055cfde627c75f71735eabbf01af2a196bd8b00a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Packets sent to to link-local addresses on it are never received. We
don't know why this happens, as the tooling provided by Apple for
development is close to useless. So we just ignore this interface.
Task-number: QTBUG-61041
Change-Id: Ia608df1fff6bdee5238e107d8a50292a1f9e5c03
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
It was grabbing a QLabel without accounting for the size of
the window in the case where the DPI is larger than 1:
FAIL! : tst_QWidget::translucentWidget() Compared values are not the same
Actual (actual.size()) : QSize(32x32)
Expected (expected.size()): QSize(16x16)
Change-Id: I4873f3c6364ee2696f5612d91e6c97c60b2cd915
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
tst_QSharedPointer can't create a pipe as the OS has too many files
open. Systems like macOS have a lower limit to these simultaneous files
open.
Task-number: QTBUG-60410
Change-Id: I21e89f992ada2a7d09b706522a05b5952f00ec33
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is a followup to 77a8e90cdd which
didn't handle the case where no columns had been moved.
visualIndices and logicalIndices are empty until initializeIndexMapping()
is called, in which case appending is wrong.
As a result, visualIndex(i) would return -1 for the values over
those added by read(), and an assert would happen at painting time.
The fix is to leave visualIndices and logicalIndices empty if
they are empty already, leaving it to initializeIndexMapping()
to fill them later if necessary (e.g. when moving a column).
Task-number: QTBUG-60837
Change-Id: Ia7e4b9d3122647984acd434dfaa0400df319d065
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
They have been blacklisted on windows previously and now fail on
macOS 10.12 as well.
Task-number: QTBUG-60993
Change-Id: Ib7a3acfc7f2285c0a587d4abd88a4a218391d623
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When the mouse is moved over a header section then if there is a status
tip then this should be sent as an event like it would for a typical
QAbstractItemView.
Also adds a test for the StatusTipRole for the QTreeView itself as well as
the header.
Task-number: QTBUG-2066
Change-Id: Iaef8d91f1bd621c2463cde2dff4b2291fb037975
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Limitation is that the signal needs to be parameter-less
[ChangeLog][moc] moc now supports NOTIFY signals of parent classes in Q_PROPERTY
Change-Id: Iad64c96c3ec65d4be8ad9ff1a9f889938ab9bf45
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
The test has been observed to be flaky on Windows. Introduce
QTRY_VERIFY_WITH_TIMEOUT for diagnostics.
Change-Id: I72abdd2e5544f8f35199876486ab15151f60e5f2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
According to the test metrics this test failed 10 times in the last two
days. Interestingly the log shows that usually 5.5 seconds would have
let it pass.
Change-Id: I38f21f35bd6624f1d3de1e1e811a4d107136a241
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Corresponds to the similar function QPainterPath::intersects() and is
faster than calculating the intersection and then checking if it is
empty.
Change-Id: I694bb2206ed330a456a41d4118a952a68177b7a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
There was only one place that needed it.
Change-Id: I067fcfe299b34ab6a771fffd14bf2945f1953d10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QPainterPath could in certain cases where sub-path points were on the
border of a rect fail to calculate intersects() correctly.
The patch adds handling of such cases by looking if end points cross in
or out of the rect. Other cases are already caught.
Task-number: QTBUG-31551
Change-Id: I6284da8ff8646d4636702923a76362302dde5767
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Also mark as shared-come-qt6,
[ChangeLog][QtNetwork][QHostInfo] Added swap() and move operator.
Change-Id: I8f422868f0487a37aeba3bc74685dc4912e9b3a4
Coverity-Id: 168204
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've
been using for all other out-of-line string-view member functions to
avoid forcing string-view objects onto the stack for the passing of 'this'.
In the test, had to fix nullness not being propagated from a QByteArray
to the QLatin1String constructed from it. Probably worth fixing in
QLatin1String(QByteArray), too.
[ChangeLog][QtCore] Added qTrimmed() free functions.
[ChangeLog][QtCore][QLatin1String] Added trimmed() function.
Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is often more natural than (ptr, len), and I need it in the
implementation of QStringView::trimmed().
Change-Id: I1d99b5ddaf76eee0582150b0233ef6ce9c37d25d
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Emulation of non-logical coordinate mode gradients was implemented by
essentially 3 x 2 repetitions of the same manipulation of the QBrush
transform. Avoid the code duplication by extracting a common method.
Add lancelot test scripts that excersizes these code paths.
Change-Id: I7baa921923231ef9e83e443dba996b82b32ad1e7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
No need to have two enums for the exact same purpose.
qmacstyle auto-test updated as well.
Change-Id: Ia601648191e39c0cbbaa7477143441005ae063c2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Known to fail now and then, most likely due to the mouse cursor
moving while the test is executing.
Task-number: QTBUG-60754
Change-Id: Id8f0786416d0df33f197a7a8f99b7aad1341a6be
Reviewed-by: Liang Qi <liang.qi@qt.io>
QWidget has its own setVisible() code that needs to
be run in order to correctly transition widget visibility.
It is desirable to be able to show and hide (native)
widgets also from the QWindow side, for example from
the platform plugin, or from generic QWindow handling
code in QtGui.
Add a new virtual QWindowPrivate::setVisible() and
move the QWindow visibility implementation there.
Subclasses can now override this function to add custom
code.
Make QWidgetPrivate::show/hide_sys() call the QWindowPrivate
setVisible implementation instead of the QWindow setVisible
public API.
Change-Id: I082f174b100659e1221d5898b490f8a9f498abdf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
On winrt, the default application version is determined by its
manifest file. The template's default version is 1.0.0.0.
Additionally addRemoveLibPaths should not fail if libraryPaths
only contains currentDir.
Change-Id: Ifdd517f1bfe2fdf641f3d728ebe1fa144df1a8ca
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>