diff options
Diffstat (limited to 'src/plugins/qmldesigner/components')
-rw-r--r-- | src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp | 13 | ||||
-rw-r--r-- | src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 5d7b1aeaaf..245d604707 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -85,6 +85,11 @@ QUrl FileResourcesModel::path() const return m_path; } +QUrl FileResourcesModel::dirPath() const +{ + return QUrl::fromLocalFile(m_dirPath.path()); +} + void FileResourcesModel::setFilter(const QString &filter) { if (m_filter != filter) { @@ -162,16 +167,14 @@ void FileResourcesModel::setupModel() m_lock = true; m_model.clear(); - QDir dir; - - dir = QFileInfo(m_path.toLocalFile()).dir(); + m_dirPath = QFileInfo(m_path.toLocalFile()).dir(); QStringList filterList = m_filter.split(QLatin1Char(' ')); - QDirIterator it(dir.absolutePath(), filterList, QDir::Files, QDirIterator::Subdirectories); + QDirIterator it(m_dirPath.absolutePath(), filterList, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { QString absolutePath = it.next(); - m_model.append(dir.relativeFilePath(absolutePath)); + m_model.append(m_dirPath.relativeFilePath(absolutePath)); } m_lock = false; diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h index e0d6fc9725..cfffeeaca4 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h @@ -40,6 +40,7 @@ class FileResourcesModel : public QObject Q_PROPERTY(QString filter READ filter WRITE setFilter) Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) Q_PROPERTY(QUrl path READ path WRITE setPath) + Q_PROPERTY(QUrl dirPath READ dirPath) Q_PROPERTY(QStringList fileModel READ fileModel NOTIFY fileModelChanged) public: @@ -51,6 +52,7 @@ public: void setFileNameStr(const QString &fileName); void setPath(const QUrl &url); QUrl path() const; + QUrl dirPath() const; void setFilter(const QString &filter); QString filter() const; QStringList fileModel() const; @@ -71,6 +73,7 @@ private: private: QUrl m_fileName; QUrl m_path; + QDir m_dirPath; QString m_filter; bool m_lock; QString m_currentPath; |