Debian Codegraph @

lxqt-config-file-associations/mimetypeitemmodel.h

raw
1 /*
2 * Copyright (c) 2015 Christian Surlykke
3 *
4 * This file is part of the LXQt project. <https://lxqt-project.org>
5 * It is distributed under the LGPL 2.1 or later license.
6 * Please refer to the LICENSE file for a copy of the license, and
7 * the AUTHORS file for copyright and authorship information.
8 */
9
10 #ifndef MIMETYPEITEMMODEL_H
11 #define MIMETYPEITEMMODEL_H
12
13 #include <QAbstractItemModel>
14 #include <QSortFilterProxyModel>
15
16 #include <XdgMime>
17
18 // Used for MimetypeItemModel::data to return a QVariant wrapping an XdgMimeInfo*
19 #define MimeInfoRole 32
20
21 Q_DECLARE_METATYPE(XdgMimeInfo*)
22
23 /*!
24 *
25 */
26 class MimetypeItemModel : public QAbstractItemModel
27 {
28 public:
29 MimetypeItemModel(QObject *parent = 0);
30 virtual ~MimetypeItemModel();
31
32 QVariant data(const QModelIndex &index, int role) const;
33 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
34 QModelIndex parent(const QModelIndex &index) const;
35 int rowCount(const QModelIndex &parent = QModelIndex()) const;
36 int columnCount(const QModelIndex &parent = QModelIndex()) const {return 1;}
37 };
38
39 class MimetypeFilterItemModel : public QSortFilterProxyModel
40 {
41 public:
42 MimetypeFilterItemModel(QObject *parent = 0);
43
44 bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
45
46 bool filterHelper(QModelIndex& source_index) const;
47 };
48
49
50 #endif /* MIMETYPEITEMMODEL_H */
51