diff options
| -rw-r--r-- | src/plugins/qmllint/quick/quicklintplugin.cpp | 6 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/data/pluginQuick_anchors.qml | 4 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 12 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/plugins/qmllint/quick/quicklintplugin.cpp b/src/plugins/qmllint/quick/quicklintplugin.cpp index b2248d3896..6e2d1e7382 100644 --- a/src/plugins/qmllint/quick/quicklintplugin.cpp +++ b/src/plugins/qmllint/quick/quicklintplugin.cpp @@ -255,12 +255,6 @@ void AnchorsValidatorPass::run(const QQmlSA::Element &element) bottom = srcLoc; else if (propertyName == u"baseline") baseline = srcLoc; - - if (propertyName == u"horizontalCenter" || propertyName == u"verticalCenter") { - if (groupBinding.bindingType() == QQmlJSMetaPropertyBinding::Null) { - emitWarning("Cannot anchor to a null item.", srcLoc); - } - } } } diff --git a/tests/auto/qml/qmllint/data/pluginQuick_anchors.qml b/tests/auto/qml/qmllint/data/pluginQuick_anchors.qml index ddfa163479..ea98b76663 100644 --- a/tests/auto/qml/qmllint/data/pluginQuick_anchors.qml +++ b/tests/auto/qml/qmllint/data/pluginQuick_anchors.qml @@ -2,10 +2,10 @@ import QtQuick Item { Item { - anchors.horizontalCenter: parent.horizontalCenter + anchors.horizontalCenter: null anchors.left: parent.left anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: null anchors.top: parent.top anchors.bottom: parent.bottom anchors.baseline: parent.baseline diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 6110ee5448..492ec95350 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -37,6 +37,8 @@ Q_IMPORT_PLUGIN(LintPlugin) +using namespace Qt::StringLiterals; + class TestQmllint: public QQmlDataTest { Q_OBJECT @@ -1664,13 +1666,15 @@ void TestQmllint::quickPlugin() QVERIFY(pluginFound); runTest("pluginQuick_anchors.qml", - Result { - { Message { + Result{ { Message{ u"Cannot specify left, right, and horizontalCenter anchors at the same time."_qs }, Message { u"Cannot specify top, bottom, and verticalCenter anchors at the same time."_qs }, - Message { - u"Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors."_qs } } }); + Message{ + u"Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors."_qs }, + Message{ u"Cannot assign binding of type null to QQuickAnchorLine"_s, 5, 35 }, + Message{ u"Cannot assign binding of type null to QQuickAnchorLine"_s, 8, + 33 } } }); runTest("pluginQuick_layoutChildren.qml", Result { { Message { |
