X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fmultilineedit.cpp;h=a0e0e8cc06644c089f97e2ccd7243b61ac1ebbf5;hp=14eecf23b0f822c42ae95f3bf26381adb03f870b;hb=9dc0131dab77e3d3173906f1f8b14d3447523aea;hpb=c238c56e7a5f040522c1675a5a630411eaa0da4f diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 14eecf23..a0e0e8cc 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -23,6 +23,7 @@ #include #include +#include "actioncollection.h" #include "bufferview.h" #include "graphicalui.h" #include "multilineedit.h" @@ -31,12 +32,7 @@ const int leftMargin = 3; MultiLineEdit::MultiLineEdit(QWidget *parent) - : -#ifdef HAVE_KDE - KTextEdit(parent), -#else - QTextEdit(parent), -#endif + : MultiLineEditParent(parent), _idx(0), _mode(SingleLine), _singleLine(true), @@ -237,6 +233,22 @@ bool MultiLineEdit::addToHistory(const QString &text, bool temporary) { return false; } +bool MultiLineEdit::event(QEvent *e) { + // We need to make sure that global shortcuts aren't eaten + if(e->type() == QEvent::ShortcutOverride) { + QKeyEvent* event = static_cast(e); + QKeySequence key = QKeySequence(event->key() | event->modifiers()); + foreach(QAction *action, GraphicalUi::actionCollection()->actions()) { + if(action->shortcuts().contains(key)) { + e->ignore(); + return false; + } + } + } + + return MultiLineEditParent::event(e); +} + void MultiLineEdit::keyPressEvent(QKeyEvent *event) { // Workaround the fact that Qt < 4.5 doesn't know InsertLineSeparator yet #if QT_VERSION >= 0x040500 @@ -255,11 +267,7 @@ void MultiLineEdit::keyPressEvent(QKeyEvent *event) { on_returnPressed(); return; } -#ifdef HAVE_KDE - KTextEdit::keyPressEvent(event); -#else - QTextEdit::keyPressEvent(event); -#endif + MultiLineEditParent::keyPressEvent(event); return; }