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.

Pick-to: 6.8 6.7
Task-number: QTBUG-127562
Change-Id: Ia403b2d3aec0991613bf444d0047aa040db2bf65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Sami Shalayel 2024-07-26 16:07:06 +02:00
parent 45c21c39f0
commit dfc7521a82
4 changed files with 24 additions and 7 deletions

View File

@ -717,10 +717,6 @@ void QmlLintQuickPlugin::registerPasses(QQmlSA::PassManager *manager,
"SwipeDelegate attached property must be attached to an object deriving from Item");
addAttachedWarning({ "QtQuick.Templates", "SwipeView" }, { { "QtQuick", "Item" } },
"SwipeView attached property must be attached to an object deriving from 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" } } });

View File

@ -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
}
}

View File

@ -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
}
}
}

View File

@ -2291,11 +2291,14 @@ void TestQmllint::quickPlugin()
Message { u"StackView attached property must be attached to an object deriving from Item"_s },
Message { u"TextArea attached property must be attached to an object deriving from Flickable"_s },
Message { u"StackLayout attached property must be attached to an object deriving from Item"_s },
Message {
u"Tumbler: attached properties of Tumbler must be accessed through a delegate item"_s },
Message { u"SwipeDelegate attached property must be attached to an object deriving from Item"_s },
Message { u"SwipeView attached property must be attached to an object deriving from Item"_s } } });
{
const Result result{ {}, { Message{ u"Tumbler"_s }, }, };
runTest("pluginQuick_tumblerGood.qml", result);
}
runTest("pluginQuick_swipeDelegate.qml",
Result { {
Message {