diff --git a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml index 1237a672270df5b8c6b47059e679a622fda2013b..f4b11113196e476d5fdec42673e3589d830c5630 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml +++ b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml @@ -433,7 +433,7 @@ Rectangle { // border Rectangle { anchors.fill:parent; - color:"Transparent"; + color:"#000000" border.width:1; border.color:"#8F8F8F"; } diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp index c765acffc1b8ae8a71e36eb0c63cab826a189f27..6f0e1dcee8081ff008028ca8645dc19b610416c9 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.cpp @@ -9,6 +9,7 @@ class QmlProjectItemPrivate : public QObject { public: QString sourceDirectory; + QStringList libraryPaths; QList<QmlFileFilterItem*> qmlFileFilters() const; @@ -78,6 +79,23 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath) emit sourceDirectoryChanged(); } +QStringList QmlProjectItem::libraryPaths() const +{ + const Q_D(QmlProjectItem); + return d->libraryPaths; +} + +void QmlProjectItem::setLibraryPaths(const QStringList &libraryPaths) +{ + Q_D(QmlProjectItem); + + if (d->libraryPaths == libraryPaths) + return; + + d->libraryPaths = libraryPaths; + emit libraryPathsChanged(); +} + /* Returns list of absolute paths */ QStringList QmlProjectItem::files() const { diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h index 4e2bf780947a4d03ceed668857ff050c91dee41c..31ad175d05ae7959f91f9fd555ca37b62310ce5b 100644 --- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h +++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectitem.h @@ -23,6 +23,7 @@ class QmlProjectItem : public QObject { Q_PROPERTY(QmlList<QmlProjectManager::QmlProjectContentItem*> *content READ content DESIGNABLE false) Q_PROPERTY(QString sourceDirectory READ sourceDirectory NOTIFY sourceDirectoryChanged) + Q_PROPERTY(QStringList libraryPaths READ libraryPaths WRITE setLibraryPaths NOTIFY libraryPathsChanged) Q_CLASSINFO("DefaultProperty", "content"); @@ -35,11 +36,15 @@ public: QString sourceDirectory() const; void setSourceDirectory(const QString &directoryPath); + QStringList libraryPaths() const; + void setLibraryPaths(const QStringList &paths); + QStringList files() const; signals: void qmlFilesChanged(); void sourceDirectoryChanged(); + void libraryPathsChanged(); protected: QmlProjectItemPrivate *d_ptr; diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp index d46b86f5553180d2f2b6390f69c7ace66f15fa97..a12de28f1b3bb062c38035cc5dde7e8226aea941 100644 --- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp +++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp @@ -15,6 +15,7 @@ public: private slots: void testFileFilter(); + void testLibraryPaths(); }; TestProject::TestProject() @@ -204,6 +205,36 @@ void TestProject::testFileFilter() } } +void TestProject::testLibraryPaths() +{ + // + // search for qml files in local directory + // + QString projectFile = QLatin1String( + "import QmlProject 1.0\n" + "Project {\n" + " libraryPaths: [ \"../otherLibrary\", \"library\" ]\n" + "}\n"); + + { + QmlEngine engine; + QmlComponent component(&engine); + component.setData(projectFile.toUtf8(), QUrl()); + if (!component.isReady()) + qDebug() << component.errorsString(); + QVERIFY(component.isReady()); + + QmlProjectItem *project = qobject_cast<QmlProjectItem*>(component.create()); + QVERIFY(project); + + project->setSourceDirectory(testDataDir); + + QStringList expectedPaths(QStringList() << "../otherLibrary" + << "library"); + QCOMPARE(project->libraryPaths().toSet(), expectedPaths.toSet()); + } +} + QTEST_MAIN(TestProject); #include "tst_fileformat.moc"