* dynamic_cast -> static_cast; results aren't checked, but are guaranteed
* return a value for context menu events svn path=/trunk/KDE/kdelibs/; revision=1173181
This commit is contained in:
parent
0c07c7dfdd
commit
e92ac18329
@ -28,6 +28,7 @@
|
|||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QGraphicsSceneContextMenuEvent>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QGraphicsSceneWheelEvent>
|
#include <QGraphicsSceneWheelEvent>
|
||||||
|
|
||||||
@ -227,12 +228,11 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
QString trigger;
|
QString trigger;
|
||||||
Qt::KeyboardModifiers modifiers;
|
Qt::KeyboardModifiers modifiers;
|
||||||
|
|
||||||
//strict typing sucks sometimes.
|
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
{
|
{
|
||||||
QMouseEvent *e = dynamic_cast<QMouseEvent*>(event);
|
QMouseEvent *e = static_cast<QMouseEvent*>(event);
|
||||||
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
||||||
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
||||||
trigger += mouse.valueToKey(e->button());
|
trigger += mouse.valueToKey(e->button());
|
||||||
@ -241,8 +241,9 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
}
|
}
|
||||||
case QEvent::GraphicsSceneMousePress:
|
case QEvent::GraphicsSceneMousePress:
|
||||||
case QEvent::GraphicsSceneMouseRelease:
|
case QEvent::GraphicsSceneMouseRelease:
|
||||||
|
case QEvent::GraphicsSceneMouseDoubleClick:
|
||||||
{
|
{
|
||||||
QGraphicsSceneMouseEvent *e = dynamic_cast<QGraphicsSceneMouseEvent*>(event);
|
QGraphicsSceneMouseEvent *e = static_cast<QGraphicsSceneMouseEvent*>(event);
|
||||||
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
||||||
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
||||||
trigger += mouse.valueToKey(e->button());
|
trigger += mouse.valueToKey(e->button());
|
||||||
@ -251,7 +252,7 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
}
|
}
|
||||||
case QEvent::Wheel:
|
case QEvent::Wheel:
|
||||||
{
|
{
|
||||||
QWheelEvent *e = dynamic_cast<QWheelEvent*>(event);
|
QWheelEvent *e = static_cast<QWheelEvent*>(event);
|
||||||
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
||||||
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
||||||
trigger = "wheel:";
|
trigger = "wheel:";
|
||||||
@ -261,7 +262,7 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
}
|
}
|
||||||
case QEvent::GraphicsSceneWheel:
|
case QEvent::GraphicsSceneWheel:
|
||||||
{
|
{
|
||||||
QGraphicsSceneWheelEvent *e = dynamic_cast<QGraphicsSceneWheelEvent*>(event);
|
QGraphicsSceneWheelEvent *e = static_cast<QGraphicsSceneWheelEvent*>(event);
|
||||||
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
int o = QObject::staticQtMetaObject.indexOfEnumerator("Orientations");
|
||||||
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
QMetaEnum orient = QObject::staticQtMetaObject.enumerator(o);
|
||||||
trigger = "wheel:";
|
trigger = "wheel:";
|
||||||
@ -269,6 +270,15 @@ QString ContainmentActions::eventToString(QEvent *event)
|
|||||||
modifiers = e->modifiers();
|
modifiers = e->modifiers();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QEvent::GraphicsSceneContextMenu:
|
||||||
|
case QEvent::ContextMenu:
|
||||||
|
{
|
||||||
|
int m = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
||||||
|
QMetaEnum mouse = QObject::staticQtMetaObject.enumerator(m);
|
||||||
|
trigger = mouse.valueToKey(Qt::RightButton);
|
||||||
|
modifiers = Qt::NoModifier;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user