Add KAcceleratorManager
This way containment context menus and PlasmaComponents Menu get accelerators assigned to by default. CHANGELOG: Most (context) menus have accelerators (Alt+letter shortcuts) now BUG: 361915 Differential Revision: https://phabricator.kde.org/D5057
This commit is contained in:
parent
76af5399dd
commit
ff78b9e531
@ -16,6 +16,7 @@ target_link_libraries(plasmacomponentsplugin
|
||||
Qt5::Quick
|
||||
Qt5::Qml
|
||||
Qt5::Gui
|
||||
KF5::WidgetsAddons # for KAcceleratorManager
|
||||
KF5::Declarative
|
||||
KF5::Plasma
|
||||
KF5::IconThemes
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <QQuickItem>
|
||||
#include <QScreen>
|
||||
|
||||
#include <KAcceleratorManager>
|
||||
|
||||
#include "plasmacomponentsplugin.h"
|
||||
QMenuProxy::QMenuProxy(QObject *parent)
|
||||
: QObject(parent),
|
||||
@ -34,6 +36,7 @@ QMenuProxy::QMenuProxy(QObject *parent)
|
||||
{
|
||||
if (qobject_cast<QApplication *>(QCoreApplication::instance())) {
|
||||
m_menu = new QMenu(0);
|
||||
KAcceleratorManager::manage(m_menu);
|
||||
connect(m_menu, &QMenu::triggered, this, &QMenuProxy::itemTriggered);
|
||||
connect(m_menu, &QMenu::aboutToHide, [ = ]() {
|
||||
m_status = DialogStatus::Closed;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QMimeData>
|
||||
|
||||
#include <kactioncollection.h>
|
||||
#include <KAcceleratorManager>
|
||||
#include <kauthorized.h>
|
||||
#include <QDebug>
|
||||
#include <klocalizedstring.h>
|
||||
@ -1017,6 +1018,8 @@ void ContainmentInterface::mousePressEvent(QMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
KAcceleratorManager::manage(desktopMenu);
|
||||
|
||||
desktopMenu->popup(pos);
|
||||
event->setAccepted(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user