diff options
| author | Sami Shalayel <sami.shalayel@qt.io> | 2024-07-26 16:07:06 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-08-13 16:29:07 +0000 |
| commit | 879f54f9e8939e0f7d61549c77cc06a7305fbd42 (patch) | |
| tree | 77e695ad33f79cf4c329c082e892b717169ae36d | |
| parent | 6dd8348d6e0f5929dc425d9a9a7f8dc18b4528cc (diff) | |
qmllint: disable the tumbler warning in qmllint
The tumbler warning in qmllint does deliver false positives, even on the
code used by the documentation. Disable the warning for now, and use
QTBUG-127562 to track work on fixing the tumbler warning.
Add a test for the tumbler where the warning should not be received.
Task-number: QTBUG-127562
Change-Id: Ia403b2d3aec0991613bf444d0047aa040db2bf65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dfc7521a8216ce05c38fb9d143b86e7fa8f1aeeb)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 837af013a0cd691459716088796495d10e2c2138)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| -rw-r--r-- | src/plugins/qmllint/quick/quicklintplugin.cpp | 4 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/data/pluginQuick_attached.qml | 1 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/data/pluginQuick_tumblerGood.qml | 19 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 7 |
4 files changed, 24 insertions, 7 deletions
diff --git a/src/plugins/qmllint/quick/quicklintplugin.cpp b/src/plugins/qmllint/quick/quicklintplugin.cpp index 2f6118b580..a223527ee9 100644 --- a/src/plugins/qmllint/quick/quicklintplugin.cpp +++ b/src/plugins/qmllint/quick/quicklintplugin.cpp @@ -714,10 +714,6 @@ void QmlLintQuickPlugin::registerPasses(QQmlSA::PassManager *manager, "Attached properties of SwipeDelegate must be accessed through an Item"); addAttachedWarning({ "QtQuick.Templates", "SwipeView" }, { { "QtQuick", "Item" } }, "SwipeView must be attached to an Item"); - addAttachedWarning( - { "QtQuick.Templates", "Tumbler" }, { { "QtQuick", "Tumbler" } }, - "Tumbler: attached properties of Tumbler must be accessed through a delegate item", - true); addVarBindingWarning("QtQuick.Templates", "Tumbler", { { "contentItem", { "QtQuick", "PathView" } }, { "contentItem", { "QtQuick", "ListView" } } }); diff --git a/tests/auto/qml/qmllint/data/pluginQuick_attached.qml b/tests/auto/qml/qmllint/data/pluginQuick_attached.qml index c5f4e0d552..b63147a9b2 100644 --- a/tests/auto/qml/qmllint/data/pluginQuick_attached.qml +++ b/tests/auto/qml/qmllint/data/pluginQuick_attached.qml @@ -21,7 +21,6 @@ Item { property int swipeView: SwipeView.index // Read-only TextArea.flickable: TextArea {} ToolTip.delay: 50 - property bool tumbler: Tumbler.displacement // Read-only property bool swipeDelegate: SwipeDelegate.pressed // Read-only } } diff --git a/tests/auto/qml/qmllint/data/pluginQuick_tumblerGood.qml b/tests/auto/qml/qmllint/data/pluginQuick_tumblerGood.qml new file mode 100644 index 0000000000..5b4bed1f33 --- /dev/null +++ b/tests/auto/qml/qmllint/data/pluginQuick_tumblerGood.qml @@ -0,0 +1,19 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls + +Rectangle { + // modified from the Tumbler documentation at https://doc.qt.io/qt-6/qml-qtquick-controls-tumbler.html + Component { + id: delegateComponent + + Label { + text: formatText(Tumbler.tumbler.count, modelData) + opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2) + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index d24db38c77..7ee69e6d3b 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -2135,11 +2135,14 @@ void TestQmllint::quickPlugin() Message { u"TextArea must be attached to a Flickable"_s }, Message { u"StackLayout must be attached to an Item"_s }, Message { - u"Tumbler: attached properties of Tumbler must be accessed through a delegate item"_s }, - Message { u"Attached properties of SwipeDelegate must be accessed through an Item"_s }, Message { u"SwipeView must be attached to an Item"_s } } }); + { + const Result result{ {}, { Message{ u"Tumbler"_s }, }, }; + runTest("pluginQuick_tumblerGood.qml", result); + } + runTest("pluginQuick_swipeDelegate.qml", Result { { Message { |
