Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
bookmarkfiltermodel.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3#ifndef BOOKMARKFILTERMODEL_H
4#define BOOKMARKFILTERMODEL_H
5
6#include <QtCore/QPersistentModelIndex>
7
8#include <QtCore/QAbstractProxyModel>
9#include <QtCore/QSortFilterProxyModel>
10
12
13class BookmarkItem;
14class BookmarkModel;
15
17
19{
21public:
22 explicit BookmarkFilterModel(QObject *parent = nullptr);
23
24 void setSourceModel(QAbstractItemModel *sourceModel) override;
25
26 int rowCount(const QModelIndex &index) const override;
27 int columnCount(const QModelIndex &index) const override;
28
29 QModelIndex mapToSource(const QModelIndex &proxyIndex) const override;
30 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override;
31
32 QModelIndex parent(const QModelIndex &child) const override;
33 QModelIndex index(int row, int column, const QModelIndex &parent) const override;
34
35 Qt::DropActions supportedDropActions () const override;
36 Qt::ItemFlags flags(const QModelIndex &index) const override;
37
38 QVariant data(const QModelIndex &index, int role) const override;
39 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
40
41 void filterBookmarks();
43
44private slots:
46 void rowsInserted(const QModelIndex &parent, int start, int end);
47 void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
48 void rowsRemoved(const QModelIndex &parent, int start, int end);
49 void layoutAboutToBeChanged();
50 void layoutChanged();
51 void modelAboutToBeReset();
52 void modelReset();
53
54private:
55 void setupCache(const QModelIndex &parent);
56 void collectItems(const QModelIndex &parent);
57
58private:
59 BookmarkModel *sourceModel = nullptr;
61 QPersistentModelIndex indexToRemove;
62 bool hideBookmarks = true;
63};
64
65// -- BookmarkTreeModel
66
68{
70public:
72 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
73
74protected:
75 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
76};
77
78QT_END_NAMESPACE
79
80#endif // BOOKMARKFILTERMODEL_H
QList< QPersistentModelIndex > PersistentModelIndexCache
bool eventFilter(QObject *object, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
~BookmarkDialog() override
Qt::DropActions supportedDropActions() const override
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
Reimplement this function to return the model index in the source model that corresponds to the proxy...
QVariant data(const QModelIndex &index, int role) const override
Returns the data stored under the given role for the item referred to by the index.
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Sets the role data for the item at index to value.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given index.
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
Reimplement this function to return the model index in the proxy model that corresponds to the source...
QModelIndex index(int row, int column, const QModelIndex &parent) const override
Returns the index of the item in the model specified by the given row, column and parent index.
int rowCount(const QModelIndex &index) const override
Returns the number of rows under the given parent.
int columnCount(const QModelIndex &index) const override
Returns the number of columns for the children of the given parent.
QModelIndex parent(const QModelIndex &child) const override
void setSourceModel(QAbstractItemModel *sourceModel) override
Sets the given sourceModel to be processed by the proxy model.
void setItemsEditable(bool editable)
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns true if the item in the row indicated by the given source_row and source_parent should be inc...
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns for the children of the given parent.
static HelpEngineWrapper & instance()
Combined button and popup list for selecting options.
#define TRACE_OBJ
Definition tracer.h:34