on xenial help sign in
Use QVariantList for actions property.
commit1e5f741947d330b17d1b47b0420d6438ef033e00 authorPawel Stolowski <pawel.stolowski@canonical.com> dateWed 26 Jun 2013, 17:33 (13 years ago) parentad2923e
4 files changed+12−8
plugins/Unity/plugin.cpp+1 plugins/Unity/preview.cpp+7−4 plugins/Unity/preview.h+2−2 plugins/Unity/previewaction.h+2−2
plugins/Unity/plugin.cpp+1
@@ -25,6 +25,7 @@
2525
2626// local
2727#include "preview.h"
28+#include "previewaction.h"
2829#include "scope.h"
2930#include "scopes.h"
3031#include "categories.h"
plugins/Unity/preview.cpp+7−4
@@ -19,6 +19,7 @@
1919
2020// local
2121#include "preview.h"
22+#include "previewaction.h"
2223#include "genericpreview.h"
2324#include "applicationpreview.h"
2425#include "moviepreview.h"
@@ -68,14 +69,16 @@ QString Preview::subtitle () const
6869 return "";
6970}
7071
71−PreviewActionList Preview::actions()
72+QVariantList Preview::actions()
7273{
73− PreviewActionList alist;
74+ QVariantList alist;
7475 if (m_unityPreview) {
7576 for (auto unityAction: m_unityPreview->GetActions()) {
76− auto action = new PreviewAction(this);
77+ auto action = new PreviewAction(this); // preview is the owner of actions
7778 action->setUnityAction(unityAction);
78− alist.append(action);
79+ QVariant v;
80+ v.setValue(action);
81+ alist.append(v);
7982 }
8083 } else {
8184 qWarning() << "Preview not set";
plugins/Unity/preview.h+2−2
@@ -38,7 +38,7 @@ class Preview : public QObject
3838 Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
3939 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
4040 Q_PROPERTY(QString subtitle READ subtitle NOTIFY subtitleChanged)
41− Q_PROPERTY(PreviewActionList actions READ actions NOTIFY actionsChanged)
41+ Q_PROPERTY(QVariantList actions READ actions NOTIFY actionsChanged)
4242
4343public:
4444 explicit Preview(QObject *parent = 0);
@@ -47,7 +47,7 @@ public:
4747 QString rendererName() const;
4848 QString title() const;
4949 QString subtitle () const;
50− PreviewActionList actions();
50+ QVariantList actions();
5151
5252public Q_SLOTS:
5353 void execute(const QString& actionId, const QHash<QString, QVariant>& hints);
plugins/Unity/previewaction.h+2−2
@@ -65,9 +65,9 @@ private:
6565 unity::dash::Preview::ActionPtr m_unityAction;
6666};
6767
68−typedef QList<PreviewAction *> PreviewActionList;
68+//typedef QList<PreviewAction *> PreviewActionList;
6969Q_DECLARE_METATYPE(PreviewAction *)
70−Q_DECLARE_METATYPE(PreviewActionList *)
70+//Q_DECLARE_METATYPE(PreviewActionList *)
7171Q_DECLARE_METATYPE(LayoutHint)
7272
7373#endif