Browse Source

Don't grab the keyboard globally (stealing key presses from other apps) in the Errors&Warnings pane, only override the Ctrl+C and Ctrl+Ins accelerators.

git-svn-id: file:///var/svn/tigccpp/trunk@1076 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 17 years ago
parent
commit
3d38b6bf03
3 changed files with 16 additions and 16 deletions
  1. 3 1
      ktigcc/NEWS
  2. 11 12
      ktigcc/errorlist.cpp
  3. 2 3
      ktigcc/errorlist.h

+ 3 - 1
ktigcc/NEWS

@@ -1,6 +1,6 @@
 This is a summary of the changes in KTIGCC since the first alpha release:
 
-CVS HEAD (2007-04-02):
+CVS HEAD (2007-04-03):
 
 * Added a full changelog (generated from CVS logs).
 * Fixed stray indentation at the end of the line when autoclosing a curly brace
@@ -11,6 +11,8 @@ CVS HEAD (2007-04-02):
 * Don't hardcode ~/.kde for the KDE(4)HOME directory.
 * Fixed missing word wrap on the data variable reloc label in Program Options.
 * Fixed A68k items in the New menu being shown even when A68k is not installed.
+* Don't grab the keyboard globally (stealing key presses from other apps) in the
+  Errors&Warnings pane, only override the Ctrl+C and Ctrl+Ins accelerators.
 
 
 KTIGCC 1.06 (2006-11-25):

+ 11 - 12
ktigcc/errorlist.cpp

@@ -31,6 +31,17 @@
 #include <QFocusEvent>
 #include <QKeyEvent>
 
+bool ErrorList::event(QEvent *e)
+{
+  if (e->type()==QEvent::AccelOverride) {
+    QKeyEvent *ke=static_cast<QKeyEvent*>(e);
+    if ((ke->key()==Qt::Key_Insert || ke->key()==Qt::Key_C)
+        && ke->state()==Qt::ControlModifier)
+      ke->accept();
+  }
+  return QWidget::event(e);
+}
+
 void ErrorList::keyPressEvent(QKeyEvent *e)
 {
   if ((e->key()==Qt::Key_Insert || e->key()==Qt::Key_C)
@@ -48,18 +59,6 @@ void ErrorList::keyPressEvent(QKeyEvent *e)
   } else QWidget::keyPressEvent(e);
 }
 
-void ErrorList::focusInEvent(QFocusEvent *e)
-{
-  QWidget::focusInEvent(e);
-  grabKeyboard();
-}
-
-void ErrorList::focusOutEvent(QFocusEvent *e)
-{
-  releaseKeyboard();
-  QWidget::focusOutEvent(e);
-}
-
 /*
  *  Constructs a ErrorList as a child of 'parent', with the
  *  name 'name' and widget flags set to 'f'.

+ 2 - 3
ktigcc/errorlist.h

@@ -31,9 +31,8 @@ public:
     ~ErrorList();
 
 protected:
-    virtual void keyPressEvent( QKeyEvent * e );
-    virtual void focusInEvent(QFocusEvent *);
-    virtual void focusOutEvent(QFocusEvent *);
+    virtual bool event(QEvent *e);
+    virtual void keyPressEvent(QKeyEvent *e);
 
 protected slots:
     virtual void languageChange();