aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src/unitymenuaction.cpp
diff options
context:
space:
mode:
authorNick Dedekind <nicholas.dedekind@gmail.com>2013-07-30 12:23:42 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-07-30 12:23:42 +0200
commitd1c96de04570d8365c2ab2fde597ccd21c7a3dc2 (patch)
tree6abe5ac6cea1593c4effdea00c3087e4c9f37ede /libqmenumodel/src/unitymenuaction.cpp
parentd47194b0794968fa7713a8c7c9cfec7f1e4f8a17 (diff)
downloadqmenumodel-d1c96de04570d8365c2ab2fde597ccd21c7a3dc2.tar.gz
qmenumodel-d1c96de04570d8365c2ab2fde597ccd21c7a3dc2.tar.bz2
qmenumodel-d1c96de04570d8365c2ab2fde597ccd21c7a3dc2.zip
Add action role (replacing actionState role)
Diffstat (limited to 'libqmenumodel/src/unitymenuaction.cpp')
-rw-r--r--libqmenumodel/src/unitymenuaction.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/libqmenumodel/src/unitymenuaction.cpp b/libqmenumodel/src/unitymenuaction.cpp
new file mode 100644
index 0000000..f391bfe
--- /dev/null
+++ b/libqmenumodel/src/unitymenuaction.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2013 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Nick Dedekind <nick.dedekind@canonical.com>
+ */
+
+#include "unitymenuaction.h"
+#include "unitymenumodel.h"
+
+UnityMenuAction::UnityMenuAction(QObject* parent)
+ : QObject(parent),
+ m_model(NULL),
+ m_index(-1)
+{
+}
+
+int UnityMenuAction::index() const
+{
+ return m_index;
+}
+
+void UnityMenuAction::setIndex(int index)
+{
+ if (m_index != index) {
+ m_index = index;
+ Q_EMIT indexChanged(index);
+ }
+}
+
+UnityMenuModel* UnityMenuAction::model() const
+{
+ return m_model;
+}
+
+void UnityMenuAction::setModel(UnityMenuModel* model)
+{
+ if (m_model != model) {
+ if (m_model) {
+ disconnect(m_model);
+ }
+ m_model = model;
+
+ connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), SIGNAL(stateChanged()));
+
+ Q_EMIT modelChanged(model);
+ }
+}