Unfortunately value types behave differently when compiled to C++.
Document the difference and introduce a pragma to make them behave one
way or the other.
Pick-to: 6.5
Fixes: QTBUG-109221
Change-Id: Ib2685153c0b4ae209bafbea7a01229377fdb47dd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When starting to edit a cell, the current implementation
calls editItem->nextItemInFocusChain(true) to resolve the
child to get active focus. But a better way is to instead
rely on the edit item being a FocusScope. That way, we can
simply set active focus on the edit item directly, and rely
on the FocusScope forwarding active focus to the right child.
After all, that is what FocusScopes are for.
This patch will therefore change the implementation to set active
focus directly on the edit item.
But doing so turns out to cause tabbing from one cell
to the next to stop working. The reason is that QQuickItem refuses
to change setActiveFocusOnTab() on an item that has active focus.
Instead, the focus item will eat the tab event, and
use it to transfer focus to the next control in the chain.
We therefore change the implementation to use an event filter on the
focus object. That way, we're are guaranteed to always get a first
shot at handling all critical key events that are needed for editing
to work correctly. This includes tabbing, but even more
imporantant, also Qt::Key_Enter, which is needed to allow
the user to commit and close the editor.
Pick-to: 6.5
Change-Id: I215b7efc52093eb0bd7f6a4fb60a57f83101e288
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
It's a header, and at least tst_styleimports.cpp doesn't use all of
the functions, so throws a -Wunused-function warning on Clang 15 for
runTests():
qtest_quickcontrols_p.h:36:12: warning: unused function 'runTests' [-Wunused-function]
static int runTests(QObject *testObject, int argc, char *argv[])
^
Fix by marking the functions as inline instead.
Amends e310dadef7.
Pick-to: 6.5 6.4 6.2
Change-Id: Id6cee7bdc2fe93a5e034d7ed445dc5f2c5d35360
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The 'int line' variable is shadowed a few lines below by the
'QByteArray line' one, even in the initial commit, so it can never
have been used, except for the increment in the first line of the
loop's bodies.
Remove the variable, fix the warning.
Found by Clang 15:
test262runner.cpp:380:9: warning: variable 'line' set but not used [-Wunused-but-set-variable]
int line = 0;
^
Amends d9c4a52724.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I2139aa4552d1ff2ddbb5737e2a1b26650d6519e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
After TableView got support for resizable rows and columns, a
side effect is that any overlay, like the selection handles, will
need to be repositioned when rows and columns are resized.
Currenly the selection handles will instead stay put at the
initial location.
This patch will make sure that SelectionRectangle listens to
the layoutChanged() signal from TableView, and reposition the
handles.
Because the current selection rectangle implementation in
TableView didn't take row and column resizing into account
either, the logic that calculates the rectangle is also
changed. Rather than storing the selection rectangle after
each mouse drag, we now calculate the exact (and updated)
rectangle when queried instead.
Fixes: QTBUG-109448
Pick-to: 6.5
Change-Id: I80171f992bea1035c1410ede384a2d847ee3aa46
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
createSpreadArguments could in theory allocate a (nearly) unbounded
number of QV4::Values. Avoid this by checking whether we approach
jsStackTop.
This fixes CVE-2022-43591.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I01aecb979da47b7261688c9f185dc33a50a579a5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The current implementation would pick up the headerview
controls from the Basic style (fallback). The problem is
that those controls are hard-coded to always be in Light
mode.
This patch will therefore add HorizontalHeaderView.qml
and VerticalHeaderView.qml to the iOS style, and use the
palette to ensure that the headers looks correct, also
in Dark mode.
Pick-to: 6.5
Change-Id: Ic91234bae09bc73b9c1cbd2fc439d2faa23a9b72
Reviewed-by: Doris Verria <doris.verria@qt.io>
Describe the use of qsTr() and QQmlApplicationEngine, as well
as the CMake qt_add_translations command.
Task-number: QTBUG-110009
Change-Id: I7d2244a772fdb132acdb5f9f66294a7d772e0d36
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Add explicit where appropriate, and use more elegant constructs in
inline functions. Introduce removed_api.cpp for
QJSEngine::create(int, const void *).
Pick-to: 6.5
Change-Id: Ie54b0494fe3c5567f8a5ca361c3a583de3d97dd5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The estimated width in the table view has been used to layout
and accordingly, edges of the table be loaded. This estimated
width will be passed to flickable to adjust its parameters and
width/position of scroll bar. This in turn change geometry of
table view with respect to view port.
In some scenarios, this estimated width during layout causes
table view to be misaligned. This can be avoided by calculating
and updating latest content width of the table view once after
loading the edges of table.
Fixes: QTBUG-108664
Pick-to: 6.5 6.4 6.2
Change-Id: I47c3325bc9e51f75c87564a2ec1de4522e4a7e60
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Don't hard code colors in HorizontalHeaderView and
VerticalHeaderView. Instead, use colors from the
palette / style. This ensures that switching between
light and dark mode will also affect HeaderView.
Additionally, skip drawing a box around the header view
cells - doing so ends up looking quite bad, since you
will draw double lines between the cells (especially
when the columnSpace/rowSpace is 0. Instead, the border
around the cells in both TableView and HeaderView is
supposed to be drawn indirectly from setting rowSpacing
and columnSpacing to e.g 1.
Pick-to: 6.5 6.4
Change-Id: Ibc01779526aecc4f0d40fad2a6f2ea2822427e85
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The handling of the stroke color lacks the extra checks that are
performed when setting the fill color. Switching from "transparent"
to another color involves setting not just the color-dirty flag but
also the geometry-dirty since alpha == 0 may skip operations such as
triangulating, meaning the work has to be performed later when once
again switching to an alpha > 0 color.
Change-Id: Ibd6d762cfcb07ca8b9c852553c979bcb4ee9fa21
Fixes: QTBUG-109882
Pick-to: 6.5 6.4 6.2 5.15
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
In certain degenerate cases (e.g. missing imports), we might end up with
a composite type which does not have a base type.
That so far caused a crash in the binding check. To fix this, simply
detect the situation, and skip the warning – we will already warn about
the unknown type anyway.
Fixes: QTBUG-106562
Pick-to: 6.5 6.4
Change-Id: Iff7e202cf5bd6b5c8d7cb90a46fb2573cb74ecaa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We can coerce QDateTime, QDate and QTime into each other because they
would all be represented by a Date object in JavaScript. Furthermore we
can coerce them all to QString. Technically, we could also coerce
strings to all of them, but we don't want to because that is terrible.
Fixes: QTBUG-109380
Change-Id: I176bfb5b715a6a6750cb5918c44261fa23fb8832
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Since JavaScript has no concept of time or date separate from the Date
object that contains both, and since we implicitly (via
QVariant::convert) or explicitly accept string arguments to all these
methods, we should really accept string coercions of Date objects.
We should also make all the string overloads explicit. Converting
strings to QDateTime is a really obscure feature of the metatype system.
We should not rely on it.
Furthermore, we need to accept QDateTime, as the native representation
of the JavaScript Date object, as argument to formatDate() and
formatTime(). Otherwise there are two ambiguous paths to calling
formatTime() or formatDate() using a Date object: Either coerce the Date
into a string and call the string overload or coerce it into a QTime or
QDate and call the QTime or QDate overload. The QML engine special cases
this and prefers the QTime/QDate way, but this just needlessly
complicates the overload resolution.
Interestingly, tst_qqmlqt already tests most of those variants. We just
have to add the JS string coercions.
Task-number: QTBUG-109380
Change-Id: I880e622256fe115dade32bde880605df2031ff2f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
We should always use the same conversion to string and we shouldn't
duplicate the code for the date conversion.
Task-number: QTBUG-109380
Change-Id: I1b1959c8e9b5957ddcf287d252b8143511237565
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
The JavaScript date and time conversions are different from Qt's. Add
them to coerceValue.
Task-number: QTBUG-109380
Change-Id: Ic0d7dd8ff51fb8e29d80d9084d4415becaa76259
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The last call should take precedence over previous ones.
Task-number: QTBUG-110247
Change-Id: Ib5e10ab539ea6eecc3ad66aed75c81d622e0eb01
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We no longer support properties of type QQmlBinding, so we don't need
any flags for it, either.
Amends 85d258cc0d
Change-Id: I77c52baa3c0e2d7b5831216f1413bcc21eb5e321
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Ensure that negative number times positive zero yields negative zero,
not positive zero.
Do the same adjustment in QJSPrimitiveValue
Fixes: QTBUG-104582
Pick-to: 6.5
Change-Id: I8231bfb051b7d902e5e50bbd282410a572b1628a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
As a drive-by, rely on lifetime extenion for QString.
Change-Id: I903d09a3cce1fc093bac3bb059d2c246cf88c188
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
No need to allocate temporary QLists, and by using fileName, it is
clearer what we're actually doing with the string manipulation.
Change-Id: I2a780f99abe20dd648f583579183b64bf7d9ee1a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The port from QStringRef to QStringView created a few odd constructs,
like locals of type const QStringView & and explicitly creating a
QStringView from a QString before passing it to a function taking a QSV.
Clean them up.
Change-Id: I92293198266530f8ab8b9c858a0f0a96e31d7680
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Whatever CONST was, it no longer seems to be defined, and we also have
no member called CONST anymore, so we can just remove the code block.
Change-Id: I4fa9fb6f17460cc610fbcc3fb3d6e7d3db3df927
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This fixes the issue where given two hoverable MouseAreas A & B where B
masks A, the `containsMouse` property of A will be incorrectly set to
true if the cursor is positioned above both A and B and the visibility
of A is toggled from true to false back to true.
This patch fixes the above issue by checking if the QQuickMouseArea is
marked as a hovered item in its windows QQuickDeliveryAgentPrivate(QDAP)
instance. If the QQuickMouseArea is masked by another QQuickMouseArea
then it will not be a in the QDAPs hovered items list and we skip
setting the hovered property on QQuickMouseArea, fixing the issue.
This patch also adds a test case to prevent future regressions.
Fixes: QTBUG-109567
Pick-to: 6.5 6.4
Change-Id: I5f024a097b56ef5e0836ca9f8ae547983a089b44
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
All user facing strings should use qsTr()
Pick-to: 6.5
Change-Id: I2f776fe088b05bb046ceafbc6c29528212a2c1a0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This patch removes the following examples in particular:
- progressbar
- scrollbar
- searchbox
- slideswitch
- spinner
- tabwidget
The reason for removing them is that they've clearly been forgotten,
and no longer serve a purpose.
They can only be built with qmake, since they're missing a
CMakeLists.txt file, and even if you try to build them, the build will
fail since the DECLARATIVE_EXAMPLE_MAIN macro in shared.h were at some
point updated to prepend the resource patch to have the same prefix that
the AUTO_RESOURCE_PREFIX cmake flag provides. Which had the side effect
of causing these examples to no longer build out of the box.
The purpose of the examples has been to demonstrate how to make custom
controls. Today we recommend users to instead make custom styles for
QQC2, which the flatstyle example demonstrate how to do.
Pick-to: 6.5
Change-Id: I26af18ecaef836495f0c2a7e376268b1f956b1a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Testcase's window didn't always have the focus when a key
sequence was sent to it, causing occasional test failure on webOS.
After the fix we will wait for the window to become active before
sending the key sequence.
Fixes: QTBUG-110242
Pick-to: 6.5
Change-Id: I80504d8d249f16b677ce754ad8e673a011af8638
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
After caca7d7d4f, QQuickOverlay ate wheel
events to any item that was not a child of the top-most modal popup.
This broke event delivery to children of modless popups higher up in the
stack.
Fix that logic so that we don't eat events if we find a popup that the
item is a child of. Only eat the event if we don't find such a popup
before hitting the first modal popup.
Add a test with a relevant scenario, and as a drive-by, fix and simplify
the helper function sending wheel events. Since the event gets delivered
to the window, we have to use scene coordinates, not item coordinates.
This happened to work in the wheel test case as the test sliders cover
the entire window.
Fixes: QTBUG-110023
Pick-to: 6.5 6.4
Change-Id: Ibc53114cf09693e23b1e66f28a0c2056f3bd810e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
latest QuickTestUtils needs Qt::Network (QTBUG-107472)
Disable to build it and another module depending on QuickTestUtils
unless network is available.
Pick-to: 6.2 6.4 6.5
Change-Id: Ib522efa68d9ca4669afaf1fc8bbb18b079995ac1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Since we can produce QJSPrimitiveValue in metaTypeFromJS, we should also
handle the other direction.
Fixes: QTBUG-109867
Pick-to: 6.5
Change-Id: I2c7598d19eba3e78d071ca3eceb32deda4d0ead8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The documentation format for QML methods is peculiar, but this should
do for now.
Pick-to: 6.5 6.2
Fixes: QTBUG-90480
Change-Id: I0fdbb7f4a704990de1356010c8b7d44764b7e41a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
They don't actually relate to QQmlEngine, and QQmlInfo itself needs a
minimal piece of documentation.
Pick-to: 6.5
Fixes: QTBUG-109760
Change-Id: I59b7f8ab75ca038591f5bec17079f0f597455d6c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
The qmlls binary was moved back to bin.
Pick-to: 6.5
Change-Id: Ie14a8562df320b0b76902ce36f6228fda57d4b67
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Memory obtained via mmap() is not subject to heap pointer tagging. We
don't need to impose the overhead of shifting the bits around.
Amends commit c7722d4ed6.
Pick-to: 6.5
Task-number: QTBUG-101686
Task-number: QTBUG-91150
Change-Id: I45dc291c5a1208dd747199f00f819e475d5c0aec
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>