port from qgraphics events

This commit is contained in:
Marco Martin 2012-09-26 14:46:47 +02:00
parent 50cf107730
commit 7d7698360c
2 changed files with 6 additions and 9 deletions

View File

@ -117,7 +117,7 @@ class PLASMA_EXPORT ContainmentActions : public QObject
* Implement this to respond to events.
* The user can configure whatever button and modifier they like, so please don't look at
* those parameters.
* The event may be a QGraphicsSceneMouseEvent or a QGraphicsSceneWheelEvent.
* The event may be a QMouseEvent or a QWheelEvent.
*/
virtual void contextEvent(QEvent *event);

View File

@ -22,8 +22,8 @@
#include <QHash>
#include <QEvent>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsSceneWheelEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QString>
#include <kdebug.h>
@ -76,18 +76,15 @@ void ContainmentActionsPluginsConfig::addPlugin(QEvent *trigger, const QString &
void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::MouseButton button, const QString &name)
{
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
event.setButton(button);
event.setModifiers(modifiers);
QMouseEvent event(QEvent::MouseButtonPress, QPoint(), button, button, modifiers);
QString s = ContainmentActions::eventToString(&event);
d->plugins.insert(s, name);
}
void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::Orientation wheelDirection, const QString &name)
{
QGraphicsSceneWheelEvent event(QEvent::GraphicsSceneWheel);
event.setOrientation(wheelDirection);
event.setModifiers(modifiers);
//most of those parameters are just fillers
QWheelEvent event(QPoint(0,0), 0, Qt::NoButton, modifiers, wheelDirection);
QString s = ContainmentActions::eventToString(&event);
d->plugins.insert(s, name);
}