mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
46 lines
1.3 KiB
C++
Executable File
46 lines
1.3 KiB
C++
Executable File
#ifndef QQTTREEMODEL_H
|
||
#define QQTTREEMODEL_H
|
||
|
||
#include <QStandardItemModel>
|
||
#include "qqtfilesystem.h"
|
||
|
||
class QQTTreeModel : public QStandardItemModel
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit QQTTreeModel(QObject *parent, QQTFileSystem* fs);
|
||
|
||
//从查询结果中过滤出rootpath里面的内容进行保存;
|
||
void setRootPath();
|
||
//过滤,排序
|
||
inline void setNameFilter(QString filter)
|
||
{ m_fs->setNameFilter(filter); }
|
||
inline void setFilter(QDir::Filters filter = QDir::Dirs | QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot)
|
||
{ m_fs->setFilter(filter); }
|
||
inline void setSorting(QDir::SortFlags sort = QDir::DirsFirst | QDir::Name)
|
||
{ m_fs->setSorting(sort); }
|
||
|
||
bool query(QString path);
|
||
|
||
bool removeRow(int arow, const QModelIndex &aparent);
|
||
|
||
QList<QStandardItem*> findItems(const QString &text,
|
||
Qt::MatchFlags flags = Qt::MatchExactly,
|
||
int column = 0) const;
|
||
QList<QStandardItem *> findItems(const QModelIndex& parent, const QString &text,
|
||
Qt::MatchFlags flags = Qt::MatchExactly,
|
||
int column = 0) const;
|
||
signals:
|
||
|
||
public slots:
|
||
|
||
private slots:
|
||
void result();
|
||
|
||
private:
|
||
QQTFileSystem* m_fs;
|
||
QString m_path;
|
||
};
|
||
|
||
#endif // QQTTREEMODEL_H
|