File indexing completed on 2024-04-14 03:57:10

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2006 Olivier Goffart <ogoffart@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef kmenumenuhandler_p_h
0009 #define kmenumenuhandler_p_h
0010 
0011 #include <QObject>
0012 
0013 class QAction;
0014 class QMenu;
0015 
0016 class KXMLGUIBuilder;
0017 class KSelectAction;
0018 
0019 namespace KDEPrivate
0020 {
0021 /**
0022  * @internal
0023  * This class handle the context menu of QMenu.
0024  * Used by KXmlGuiBuilder
0025  * @author Olivier Goffart <ogoffart@kde.org>
0026  */
0027 class KMenuMenuHandler : public QObject
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit KMenuMenuHandler(KXMLGUIBuilder *b);
0032     ~KMenuMenuHandler() override
0033     {
0034     }
0035     void insertMenu(QMenu *menu);
0036     bool eventFilter(QObject *watched, QEvent *event) override;
0037 
0038 private Q_SLOTS:
0039     void slotSetShortcut();
0040     void buildToolbarAction();
0041     void slotAddToToolBar(int);
0042 
0043 private:
0044     void showContextMenu(QMenu *menu, const QPoint &pos);
0045 
0046     KXMLGUIBuilder *m_builder = nullptr;
0047     KSelectAction *m_toolbarAction = nullptr;
0048     QMenu *m_popupMenu = nullptr;
0049     QAction *m_popupAction = nullptr;
0050     QMenu *m_contextMenu = nullptr;
0051 };
0052 
0053 } // END namespace KDEPrivate
0054 
0055 #endif