File indexing completed on 2025-01-26 05:06:21

0001 /*
0002     SPDX-FileCopyrightText: 2014 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "menuhelper.h"
0008 
0009 #include <QAction>
0010 #include <QMenu>
0011 
0012 MenuHelper::MenuHelper(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 MenuHelper::~MenuHelper()
0018 {
0019 }
0020 
0021 QString MenuHelper::iconName(QAction *action) const
0022 {
0023     if (!action) {
0024         return QString();
0025     }
0026 
0027     return action->icon().name();
0028 }
0029 
0030 void MenuHelper::setMenu(QAction *action, QObject *menu)
0031 {
0032     QMenu *bla = qobject_cast<QMenu *>(menu);
0033 
0034     if (action && bla) {
0035         action->setMenu(bla);
0036     }
0037 }