dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dsearch.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DSEARCH_H
6#define DSEARCH_H
7
8#include <functional>
9
10#include <QObject>
11
12#include "dtksearch_global.h"
13#include "dtksearchtypes.h"
14
15DSEARCH_BEGIN_NAMESPACE
16
17class DSearchPrivate;
18class DSearch : public QObject
19{
20 Q_OBJECT
21 Q_DECLARE_PRIVATE(DSearch)
22
23 Q_PROPERTY(quint32 maxResultCount READ maxResultCount WRITE setMaxResultCount)
24 Q_PROPERTY(SearchFlags searchFlags READ searchFlags WRITE setSearchFlags)
25 Q_PROPERTY(QString indexPath READ indexPath WRITE setIndexPath)
26
27public:
28 explicit DSearch(QObject *parent = nullptr);
29 explicit DSearch(quint32 maxResultCount, SearchFlags flags, QObject *parent = nullptr);
30 ~DSearch();
31
32 bool search(const QString &path, const QString &keyword);
33 bool stop();
34 QStringList matchedResults() const;
35
36 void setResultFilter(const ResultFilterFunc &filter);
37
38 void setMaxResultCount(quint32 maxResultCount);
39 quint32 maxResultCount() const;
40 void setSearchFlags(SearchFlags flags);
41 SearchFlags searchFlags() const;
42 void setIndexPath(const QString &path);
43 QString indexPath() const;
44
45Q_SIGNALS:
46 void matched();
47 void completed();
48 void stoped();
49
50private:
51 QScopedPointer<DSearchPrivate> d_ptr;
52};
53
54DSEARCH_END_NAMESPACE
55
56#endif // DSEARCH_H
用于文件和文件内容搜索的类
Definition dsearch.h:19
void setMaxResultCount(quint32 maxResultCount)
设置最大搜索结果数量,应用与各搜索模式
bool search(const QString &path, const QString &keyword)
发起搜索
quint32 maxResultCount() const
获取最大搜索结果数
QString indexPath() const
获取索引存储路径
void setSearchFlags(SearchFlags flags)
设置搜索模式
void setIndexPath(const QString &path)
设置索引文件存储路径
bool stop()
停止搜索
void setResultFilter(const ResultFilterFunc &filter)
设置搜索结果过滤器
SearchFlags searchFlags() const
获取当前搜索模式
QStringList matchedResults() const
获取当前搜索结果