2 * Copyright 2012 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
20#ifndef FLATMENUPROXYMODEL_H
21#define FLATMENUPROXYMODEL_H
23#include <QAbstractProxyModel>
24#include <qdbusmenumodel.h>
28class FlatMenuProxyModel : public QAbstractProxyModel
31 Q_PROPERTY(int count READ count NOTIFY countChanged)
32 Q_PROPERTY(int busType READ busType WRITE setIntBusType NOTIFY busTypeChanged)
33 Q_PROPERTY(QString busName READ busName WRITE setBusName NOTIFY busNameChanged)
34 Q_PROPERTY(QString objectPath READ objectPath WRITE setObjectPath NOTIFY objectPathChanged)
35 Q_PROPERTY(int status READ status NOTIFY statusChanged)
39 FlatMenuProxyModel(QAbstractItemModel *source=0);
40 ~FlatMenuProxyModel();
42 void setSourceModel(QAbstractItemModel * sourceModel);
44 Q_INVOKABLE QVariant data(int row, int role = Qt::DisplayRole) const;
46 QModelIndex mapFromSource(const QModelIndex &index) const;
47 QModelIndex mapToSource(const QModelIndex &index) const;
49 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
50 QModelIndex parent(const QModelIndex &index) const;
51 int rowCount(const QModelIndex &parent = QModelIndex()) const;
53 int columnCount(const QModelIndex &parent) const;
55 void setBusName(const QString &busName);
56 QString busName() const;
58 void setObjectPath(const QString &busName);
59 QString objectPath() const;
61 DBusEnums::BusType busType() const;
62 void setIntBusType(int type);
67 void onModelAboutToBeReset();
76 void busTypeChanged();
77 void busNameChanged();
78 void objectPathChanged();
82 QDBusMenuModel *m_model;
83 mutable QMap<int, QString> m_indexCache;
86 int rowOffsetOf(const QModelIndex &index, int row, bool inclusive = false) const;
87 int recursiveRowCount(const QModelIndex &index) const;
88 QModelIndex index(int row, int rowCount, const QModelIndex &parent, const QString &key) const;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list