summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/fetchmore/filelistmodel.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-22 11:29:08 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-23 12:43:28 +0000
commit2393a40ccd455cc2dca410e8a1830856dbfde12d (patch)
tree5b15c09ee1f1b0e7c436cea288f3dbed3ac3bae5 /examples/widgets/itemviews/fetchmore/filelistmodel.h
parent43d6778ce59266067d2fb5adf88a1ba3f73b29ae (diff)
Rewrite the fetchmore example
- Start in root folder so that large directories (/bin/, Windows) are easily reachable - Remove the line edit and navigate by double clicking instead since this is more in line with expectations - Use a QPlainTextEdit for logging - Make the log message more informative - Add icons Change-Id: Ia3cd7fc143efef80772923291f0b711913aa47be Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/itemviews/fetchmore/filelistmodel.h')
-rw-r--r--examples/widgets/itemviews/fetchmore/filelistmodel.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/widgets/itemviews/fetchmore/filelistmodel.h b/examples/widgets/itemviews/fetchmore/filelistmodel.h
index 35cf6f7b46..1cd61f8c8e 100644
--- a/examples/widgets/itemviews/fetchmore/filelistmodel.h
+++ b/examples/widgets/itemviews/fetchmore/filelistmodel.h
@@ -52,7 +52,8 @@
#define FILELISTMODEL_H
#include <QAbstractListModel>
-#include <QStringList>
+#include <QFileInfoList>
+#include <QFileIconProvider>
//![0]
class FileListModel : public QAbstractListModel
@@ -65,8 +66,10 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QFileInfo fileInfoAt(const QModelIndex &) const;
+
signals:
- void numberPopulated(int number);
+ void numberPopulated(const QString &path, int start, int number, int total);
public slots:
void setDirPath(const QString &path);
@@ -76,8 +79,10 @@ protected:
void fetchMore(const QModelIndex &parent) override;
private:
- QStringList fileList;
- int fileCount;
+ QFileInfoList fileList;
+ QString path;
+ QFileIconProvider iconProvider;
+ int fileCount = 0;
};
//![0]