/*
* Peony-Qt's Extension
*
* Copyright (C) 2019, Tianjin KYLIN Information Technology Co., Ltd.
*
* This library 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; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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 General Public License
* along with this library. If not, see .
*
* Authors: Yue Lan
*
*/
#include "menuplugin.h"
#include
#include
using namespace Peony;
QString MenuPluginTest1::testPlugin()
{
qDebug()<<"menu test plugin1";
return QString("MenuPluginTest1");
}
QList MenuPluginTest1::menuActions(Types types, const QString &uri, const QStringList &selectionUris)
{
//return QList();
Q_UNUSED(types);
Q_UNUSED(uri);
Q_UNUSED(selectionUris);
QList actions;
QAction *action = new QAction(QIcon::fromTheme("search"), tr("plugin-sub-menu test"));
actions<parentWidget());
connect(action, &QAction::destroyed, [=]() {
qDebug()<<"delete sub menu";
menu->deleteLater();
});
menu->addAction("sub test1");
menu->addSeparator();
menu->addAction("sub test2");
action->setMenu(menu);
QAction *action2 = new QAction(QIcon::fromTheme("media-eject"), tr("plugin-action test"));
connect(action2, &QAction::triggered, [=]() {
qDebug()<<"action triggered";
});
actions<