[Containment Interface] Trigger context menus on pressing "Menu" key
When pressing the "Menu" key, pretend a right-click happened and show the containment context menu. Differential Revision: https://phabricator.kde.org/D4924
This commit is contained in:
parent
badf8acfe2
commit
94a6a168cf
@ -1045,6 +1045,15 @@ void ContainmentInterface::wheelEvent(QWheelEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContainmentInterface::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->key() == Qt::Key_Menu) {
|
||||||
|
QMouseEvent me(QEvent::MouseButtonRelease, QPoint(), Qt::RightButton, Qt::RightButton, event->modifiers());
|
||||||
|
mousePressEvent(&me);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event)
|
void ContainmentInterface::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event)
|
||||||
{
|
{
|
||||||
foreach (QAction *action, applet->contextualActions()) {
|
foreach (QAction *action, applet->contextualActions()) {
|
||||||
|
@ -151,6 +151,7 @@ protected:
|
|||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event);
|
void addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event);
|
||||||
void addContainmentActions(QMenu *desktopMenu, QEvent *event);
|
void addContainmentActions(QMenu *desktopMenu, QEvent *event);
|
||||||
|
Loading…
Reference in New Issue
Block a user