Changeset View
Changeset View
Standalone View
Standalone View
src/core/KexiSearchableModel.h
Show All 16 Lines | |||||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef KEXISEARCHABLEMODEL_H | 20 | #ifndef KEXISEARCHABLEMODEL_H | ||
21 | #define KEXISEARCHABLEMODEL_H | 21 | #define KEXISEARCHABLEMODEL_H | ||
22 | 22 | | |||
23 | #include "kexicore_export.h" | 23 | #include "kexicore_export.h" | ||
24 | #include <kexi_global.h> | 24 | #include <kexi_global.h> | ||
25 | #include <QObject> | ||||
25 | 26 | | |||
26 | class QModelIndex; | 27 | class QModelIndex; | ||
27 | class QVariant; | 28 | class QVariant; | ||
28 | class QString; | 29 | class QString; | ||
30 | class KexiSearchableModel; | ||||
31 | | ||||
32 | //! Notifier used by KexiSearchableModel to inform about deleting of the model | ||||
33 | class KEXICORE_EXPORT KexiSearchableModelDeleteNotifier : public QObject | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | public: | ||||
37 | ~KexiSearchableModelDeleteNotifier(); | ||||
38 | | ||||
39 | Q_SIGNALS: | ||||
40 | //! Emitted by KexiSearchableModel to inform about deleting of the model | ||||
41 | void aboutToDelete(KexiSearchableModel *model); | ||||
42 | | ||||
43 | private: | ||||
44 | KexiSearchableModelDeleteNotifier(); | ||||
45 | | ||||
46 | friend class KexiSearchableModel; | ||||
47 | }; | ||||
29 | 48 | | |||
30 | class KEXICORE_EXPORT KexiSearchableModel | 49 | class KEXICORE_EXPORT KexiSearchableModel | ||
31 | { | 50 | { | ||
32 | public: | 51 | public: | ||
33 | KexiSearchableModel(); | 52 | KexiSearchableModel(); | ||
34 | virtual ~KexiSearchableModel(); | 53 | virtual ~KexiSearchableModel(); | ||
35 | virtual int searchableObjectCount() const = 0; | 54 | virtual int searchableObjectCount() const = 0; | ||
36 | virtual QModelIndex sourceIndexForSearchableObject(int objectIndex) const = 0; | 55 | virtual QModelIndex sourceIndexForSearchableObject(int objectIndex) const = 0; | ||
37 | virtual QVariant searchableData(const QModelIndex &sourceIndex, int role) const = 0; | 56 | virtual QVariant searchableData(const QModelIndex &sourceIndex, int role) const = 0; | ||
38 | virtual QString pathFromIndex(const QModelIndex &sourceIndex) const = 0; | 57 | virtual QString pathFromIndex(const QModelIndex &sourceIndex) const = 0; | ||
39 | virtual bool highlightSearchableObject(const QModelIndex &index) = 0; | 58 | virtual bool highlightSearchableObject(const QModelIndex &index) = 0; | ||
40 | virtual bool activateSearchableObject(const QModelIndex &index) = 0; | 59 | virtual bool activateSearchableObject(const QModelIndex &index) = 0; | ||
60 | | ||||
61 | //! Returns notifier object that can be used to connect to its notification signal. | ||||
62 | //! This indirection is needed because the KexiSearchableModel class is not a QObject. | ||||
63 | const KexiSearchableModelDeleteNotifier* deleteNotifier() const; | ||||
64 | | ||||
65 | private: | ||||
66 | class Private; | ||||
67 | const QScopedPointer<Private> d; | ||||
41 | }; | 68 | }; | ||
42 | 69 | | |||
43 | #endif | 70 | #endif |