diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-16 16:15:22 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-30 10:35:02 +0200 |
commit | c2535eb7f843d7d6adc6497097e8fa537ce3eba4 (patch) | |
tree | 9a1ee70c2fb55ac0b740c766db42fec9b027a036 | |
parent | c3fa4a2d39dce9e20c6f0ce93465440d408dac8d (diff) |
qmllint: Take prefix into account when inserting names
Change-Id: I2c13e8fc173e5e155d07a1bbf8547df65605ba10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | tests/auto/qml/qmllint/data/ImportWithPrefix.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 7 | ||||
-rw-r--r-- | tools/qmllint/findunqualified.cpp | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/qml/qmllint/data/ImportWithPrefix.qml b/tests/auto/qml/qmllint/data/ImportWithPrefix.qml new file mode 100644 index 0000000000..6d070da21a --- /dev/null +++ b/tests/auto/qml/qmllint/data/ImportWithPrefix.qml @@ -0,0 +1,5 @@ +import "." as MyStuff + +MyStuff.Simple { + property bool something: contains(Qt.point(12, 34)) +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index cfcc6bf246..2d225aebd3 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -47,6 +47,7 @@ private Q_SLOTS: void testUnmatchedSignalHandler(); void uiQml(); void methodInScope(); + void importWithPrefix(); private: QString runQmllint(const QString &fileToLint, bool shouldSucceed); @@ -150,6 +151,12 @@ void TestQmllint::methodInScope() QVERIFY(output.isEmpty()); } +void TestQmllint::importWithPrefix() +{ + const QString output = runQmllint("ImportWithPrefix.qml", true); + QVERIFY(output.isEmpty()); +} + void TestQmllint::test() { QFETCH(QString, filename); diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp index 32eda12052..4404ddf49a 100644 --- a/tools/qmllint/findunqualified.cpp +++ b/tools/qmllint/findunqualified.cpp @@ -317,7 +317,7 @@ void FindUnqualifiedIDVisitor::importDirectory(const QString &directory, const Q while (it.hasNext()) { LanguageUtils::FakeMetaObject *fake = localQmlFile2FakeMetaObject(it.next()); m_exportedName2MetaObject.insert( - fake->className(), + prefix + fake->className(), QSharedPointer<const LanguageUtils::FakeMetaObject>(fake)); } } |