Commit e8af697f authored by Jan Möbius's avatar Jan Möbius

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6221 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 45426de4
......@@ -171,6 +171,9 @@ public:
virtual void keyPressEvent (QKeyEvent* _e);
virtual void keyReleaseEvent(QKeyEvent* _e);
// Filter alt key events under windows
//bool eventFilter(QObject *obj, QEvent *ev);
signals :
/** When this Signal is emitted when a Keyevent Event occures
......
......@@ -72,10 +72,32 @@ void CoreWidget::slotAddMenubarAction( QAction* _action , MenuActionType _type )
//=============================================================================
/*
bool CoreWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == menuBar() ) {
emit log(LOGERR,"Alt filter menubar " + QString::number(int(event->type())));
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if ( (keyEvent->key() == Qt::Key_Alt ||
keyEvent->key() == Qt::Key_Meta ) &&
keyEvent->modifiers() == Qt::AltModifier )
emit log(LOGERR,"Alt key press");
return obj->eventFilter(obj, event);
} else {
return obj->eventFilter(obj, event);
}
} else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}*/
void CoreWidget::setupMenuBar()
{
// menuBar()->installEventFilter(this);
// ======================================================================
// File Menu
// ======================================================================
......
......@@ -502,6 +502,8 @@ void CoreWidget::registerCoreKeys() {
/// if a keyPressEvent belongs to the core this functions is called
void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
emit log(LOGERR,"Key Press");
if ( ( _e->key() == Qt::Key_Meta ) && OpenFlipper::Options::isLinux() ) {
if ( _e->type() == QEvent::KeyPress ) {
setActionMode( Viewer::ExamineMode );
......@@ -510,6 +512,7 @@ void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
if ( ( _e->key() == Qt::Key_Alt ) && ! OpenFlipper::Options::isLinux() ) {
if ( _e->type() == QEvent::KeyPress ) {
emit log(LOGERR,"Switch to examine mode");
setActionMode( Viewer::ExamineMode );
}
}
......@@ -574,8 +577,12 @@ void CoreWidget::coreKeyReleaseEvent(QKeyEvent* _e){
}
}
if ( ( _e->key() == Qt::Key_Alt ) && ! OpenFlipper::Options::isLinux() ) {
emit log(LOGERR,"Key release");
if ( ( _e->key() == Qt::Key_Alt ) && !OpenFlipper::Options::isLinux() ) {
emit log(LOGERR,"Key alt release");
if ( _e->type() == QEvent::KeyRelease ) {
emit log(LOGERR,"Key alt release toggle");
setActionMode( lastActionMode() );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment