diff options
Diffstat (limited to 'src/labs/folderlistmodel')
-rw-r--r-- | src/labs/folderlistmodel/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/labs/folderlistmodel/fileinfothread.cpp | 2 | ||||
-rw-r--r-- | src/labs/folderlistmodel/fileproperty_p.h | 8 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodel.cpp | 75 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodel_p.h | 34 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h | 2 |
6 files changed, 65 insertions, 60 deletions
diff --git a/src/labs/folderlistmodel/CMakeLists.txt b/src/labs/folderlistmodel/CMakeLists.txt index b403097045..e0851ee203 100644 --- a/src/labs/folderlistmodel/CMakeLists.txt +++ b/src/labs/folderlistmodel/CMakeLists.txt @@ -19,6 +19,4 @@ qt_internal_add_qml_module(LabsFolderListModel Qt::CorePrivate Qt::QmlPrivate Qt::QmlModelsPrivate - GENERATE_CPP_EXPORTS - GENERATE_PRIVATE_CPP_EXPORTS -) + ) diff --git a/src/labs/folderlistmodel/fileinfothread.cpp b/src/labs/folderlistmodel/fileinfothread.cpp index 7b0bea721d..aa670338de 100644 --- a/src/labs/folderlistmodel/fileinfothread.cpp +++ b/src/labs/folderlistmodel/fileinfothread.cpp @@ -11,7 +11,7 @@ QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(lcFileInfoThread, "qt.labs.folderlistmodel.fileinfothread") +Q_STATIC_LOGGING_CATEGORY(lcFileInfoThread, "qt.labs.folderlistmodel.fileinfothread") FileInfoThread::FileInfoThread(QObject *parent) : QThread(parent), diff --git a/src/labs/folderlistmodel/fileproperty_p.h b/src/labs/folderlistmodel/fileproperty_p.h index 18b5f0918e..801d421ada 100644 --- a/src/labs/folderlistmodel/fileproperty_p.h +++ b/src/labs/folderlistmodel/fileproperty_p.h @@ -15,14 +15,18 @@ // We mean it. // -#include <QFileInfo> -#include <QDateTime> +#include <QtQmlIntegration/qqmlintegration.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdatetime.h> + #include <private/qglobal_p.h> QT_BEGIN_NAMESPACE class FileProperty { + Q_GADGET + QML_ANONYMOUS public: FileProperty(const QFileInfo &info) : mFileName(info.fileName()), diff --git a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp index 64a5be796e..6b1767d7a6 100644 --- a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp @@ -11,7 +11,7 @@ QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(lcFolderListModel, "qt.labs.folderlistmodel") +Q_STATIC_LOGGING_CATEGORY(lcFolderListModel, "qt.labs.folderlistmodel") class QQuickFolderListModelPrivate { @@ -232,16 +232,16 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path) Components access names and paths via the following roles: \list - \li \c fileName - \li \c filePath - \li \c fileURL (since Qt 5.2; deprecated since Qt 5.15) - \li \c fileUrl (since Qt 5.15) - \li \c fileBaseName - \li \c fileSuffix - \li \c fileSize - \li \c fileModified - \li \c fileAccessed - \li \c fileIsDir + \li \c fileName (\c string) + \li \c filePath (\c string) + \li \c fileURL (\c url) (since Qt 5.2; deprecated since Qt 5.15) + \li \c fileUrl (\c url) (since Qt 5.15) + \li \c fileBaseName (\c string) + \li \c fileSuffix (\c string) + \li \c fileSize (\c qlonglong) + \li \c fileModified (\c date) + \li \c fileAccessed (\c date) + \li \c fileIsDir (\c bool) \endlist Additionally a file entry can be differentiated from a folder entry via the @@ -284,6 +284,7 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path) Component { id: fileDelegate + required property string fileName Text { text: fileName } } @@ -375,6 +376,7 @@ QHash<int, QByteArray> QQuickFolderListModel::roleNames() const /*! \qmlproperty int FolderListModel::count + \readonly Returns the number of items in the current folder that match the filter criteria. @@ -399,7 +401,8 @@ QModelIndex QQuickFolderListModel::index(int row, int , const QModelIndex &) con The value must be a \c file: or \c qrc: URL, or a relative URL. - The default value is an invalid URL. + The default value is the application's working directory at the time + when the FolderListModel is first initialized. */ QUrl QQuickFolderListModel::folder() const { @@ -474,6 +477,7 @@ void QQuickFolderListModel::setRootFolder(const QUrl &path) /*! \qmlproperty url FolderListModel::parentFolder + \readonly Returns the URL of the parent of the current \l folder. */ @@ -544,15 +548,14 @@ void QQuickFolderListModel::componentComplete() /*! \qmlproperty enumeration FolderListModel::sortField - The \a sortField property contains field to use for sorting. sortField - may be one of: - \list - \li Unsorted - no sorting is applied. - \li Name - sort by filename - \li Time - sort by time modified - \li Size - sort by file size - \li Type - sort by file type (extension) - \endlist + The \a sortField property contains the field to use for sorting. + \c sortField may be one of: + + \value FolderListModel.Unsorted no sorting is applied + \value FolderListModel.Name sort by filename (default) + \value FolderListModel.Time sort by time modified + \value FolderListModel.Size sort by file size + \value FolderListModel.Type sort by file type/extension \sa sortReversed */ @@ -800,13 +803,13 @@ void QQuickFolderListModel::setCaseSensitive(bool on) /*! \qmlproperty enumeration FolderListModel::status \since 5.11 + \readonly This property holds the status of folder reading. It can be one of: - \list - \li FolderListModel.Null - no \a folder has been set - \li FolderListModel.Ready - the folder has been loaded - \li FolderListModel.Loading - the folder is currently being loaded - \endlist + + \value FolderListModel.Null no \a folder has been set + \value FolderListModel.Ready the folder has been loaded + \value FolderListModel.Loading the folder is currently being loaded Use this status to provide an update or respond to the status change in some way. For example, you could: @@ -867,16 +870,16 @@ void QQuickFolderListModel::setSortCaseSensitive(bool on) are available: \list - \li \c fileName - \li \c filePath - \li \c fileURL (since Qt 5.2; deprecated since Qt 5.15) - \li \c fileUrl (since Qt 5.15) - \li \c fileBaseName - \li \c fileSuffix - \li \c fileSize - \li \c fileModified - \li \c fileAccessed - \li \c fileIsDir + \li \c fileName (\c string) + \li \c filePath (\c string) + \li \c fileURL (\c url) (since Qt 5.2; deprecated since Qt 5.15) + \li \c fileUrl (\c url) (since Qt 5.15) + \li \c fileBaseName (\c string) + \li \c fileSuffix (\c string) + \li \c fileSize (\c qlonglong) + \li \c fileModified (\c date) + \li \c fileAccessed (\c date) + \li \c fileIsDir (\c bool) \endlist */ QVariant QQuickFolderListModel::get(int idx, const QString &property) const diff --git a/src/labs/folderlistmodel/qquickfolderlistmodel_p.h b/src/labs/folderlistmodel/qquickfolderlistmodel_p.h index 69a3558b43..be3dd2d2b7 100644 --- a/src/labs/folderlistmodel/qquickfolderlistmodel_p.h +++ b/src/labs/folderlistmodel/qquickfolderlistmodel_p.h @@ -31,29 +31,29 @@ class QModelIndex; class QQuickFolderListModelPrivate; //![class begin] -class Q_LABSFOLDERLISTMODEL_PRIVATE_EXPORT QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus +class Q_LABSFOLDERLISTMODEL_EXPORT QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) //![class begin] //![class props] - Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) - Q_PROPERTY(QUrl rootFolder READ rootFolder WRITE setRootFolder) - Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged) - Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) - Q_PROPERTY(SortField sortField READ sortField WRITE setSortField) - Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed) - Q_PROPERTY(bool showFiles READ showFiles WRITE setShowFiles REVISION(2, 1)) - Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs) - Q_PROPERTY(bool showDirsFirst READ showDirsFirst WRITE setShowDirsFirst) - Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot) - Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden REVISION(2, 1)) - Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) - Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION(2, 2)) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION(2, 11)) - Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION(2, 12)) + Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL) + Q_PROPERTY(QUrl rootFolder READ rootFolder WRITE setRootFolder FINAL) + Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged FINAL) + Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters FINAL) + Q_PROPERTY(SortField sortField READ sortField WRITE setSortField FINAL) + Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed FINAL) + Q_PROPERTY(bool showFiles READ showFiles WRITE setShowFiles REVISION(2, 1) FINAL) + Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs FINAL) + Q_PROPERTY(bool showDirsFirst READ showDirsFirst WRITE setShowDirsFirst FINAL) + Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot FINAL) + Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden REVISION(2, 1) FINAL) + Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable FINAL) + Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION(2, 2) FINAL) + Q_PROPERTY(int count READ count NOTIFY countChanged FINAL) + Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION(2, 11) FINAL) + Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION(2, 12) FINAL) //![class props] QML_NAMED_ELEMENT(FolderListModel) diff --git a/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h b/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h index a7c4ba1879..481ffee36a 100644 --- a/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h +++ b/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h @@ -17,6 +17,6 @@ // We mean it. // -#include <QtLabsFolderListModel/private/qtlabsfolderlistmodelexports_p.h> +#include <QtLabsFolderListModel/qtlabsfolderlistmodelexports.h> #endif // QTLABSFOLDERLISTMODELGLOBAL_P_H |