X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Finputwidget.cpp;h=11e3ec35a4ffa5152b317a0741b7b35d0643c61b;hp=ce9189eda3c858bd0b9581a09fec0c55bc9790a1;hb=f116598348bc1439ffb5df2e52e2e63ce5765bd2;hpb=88af3f967343754d06b989eef3682945eb73e346 diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index ce9189ed..11e3ec35 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -49,6 +49,7 @@ InputWidget::InputWidget(QWidget *parent) ui.ownNick->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.ownNick->installEventFilter(new MouseWheelFilter(this)); ui.inputEdit->installEventFilter(new JumpKeyHandler(this)); + ui.inputEdit->installEventFilter(this); ui.inputEdit->setMinHeight(1); ui.inputEdit->setMaxHeight(5); @@ -114,32 +115,31 @@ bool InputWidget::eventFilter(QObject *watched, QEvent *event) { if(event->type() != QEvent::KeyPress) return false; + QKeyEvent *keyEvent = static_cast(event); + // keys from BufferView should be sent to (and focus) the input line BufferView *view = qobject_cast(watched); if(view) { - QKeyEvent *keyEvent = static_cast(event); if(keyEvent->text().length() == 1 && !(keyEvent->modifiers() & (Qt::ControlModifier ^ Qt::AltModifier)) ) { // normal key press QChar c = keyEvent->text().at(0); if(c.isLetterOrNumber() || c.isSpace() || c.isPunct() || c.isSymbol()) { setFocus(); QCoreApplication::sendEvent(inputLine(), keyEvent); return true; - } else - return false; + } } - } - return false; -} - -void InputWidget::keyPressEvent(QKeyEvent * event) { - if(event->matches(QKeySequence::Find)) { - QAction *act = GraphicalUi::actionCollection()->action("ToggleSearchBar"); - if(act) { - act->toggle(); - return; + return false; + } else if(watched == ui.inputEdit) { + if(keyEvent->matches(QKeySequence::Find)) { + QAction *act = GraphicalUi::actionCollection()->action("ToggleSearchBar"); + if(act) { + act->toggle(); + return true; + } } + return false; } - AbstractItemView::keyPressEvent(event); + return false; } void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { @@ -285,7 +285,7 @@ void InputWidget::updateNickSelector() const { if(!me->userModes().isEmpty()) nicks[nickIdx] += QString(" (+%1)").arg(me->userModes()); } - + ui.ownNick->addItems(nicks); if(me && me->isAway())