on dd024c8 help sign in
unity8/plugins/Unity/Launcher/quicklistmodel.cpp
59 lines 1.5 kB history raw
1/* Copyright (C) 2013 Canonical, Ltd.
2 *
3 * Authors:
4 * Michael Zanetti <michael.zanetti@canonical.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
19#include "quicklistmodel.h"
21QuickListModel::QuickListModel(QObject *parent) :
22 QuickListModelInterface(parent)
27QuickListModel::~QuickListModel()
32void QuickListModel::appendAction(const QuickListEntry &entry)
34 beginInsertRows(QModelIndex(), m_list.count() - 1, m_list.count() -1);
35 m_list.append(entry);
36 endInsertRows();
39QuickListEntry QuickListModel::get(int index) const
41 return m_list.at(index);
44int QuickListModel::rowCount(const QModelIndex &index) const
46 Q_UNUSED(index)
47 return m_list.count();
50QVariant QuickListModel::data(const QModelIndex &index, int role) const
52 switch (role) {
53 case RoleLabel:
54 return m_list.at(index.row()).text();
55 case RoleIcon:
56 return m_list.at(index.row()).icon();
57 }
58 return QVariant();