1 /* 2 SPDX-FileCopyrightText: 2014 Eike Hein <hein@kde.org> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #include "menuhelper.h" 8 9 #include <QAction> 10 #include <QMenu> 11 MenuHelper(QObject * parent)12MenuHelper::MenuHelper(QObject *parent) 13 : QObject(parent) 14 { 15 } 16 ~MenuHelper()17MenuHelper::~MenuHelper() 18 { 19 } 20 iconName(QAction * action) const21QString MenuHelper::iconName(QAction *action) const 22 { 23 if (!action) { 24 return QString(); 25 } 26 27 return action->icon().name(); 28 } 29 setMenu(QAction * action,QObject * menu)30void MenuHelper::setMenu(QAction *action, QObject *menu) 31 { 32 QMenu *bla = qobject_cast<QMenu *>(menu); 33 34 if (action && bla) { 35 action->setMenu(bla); 36 } 37 } 38