Commit 14ca25f3 authored by Shinnok's avatar Shinnok Committed by Eike Ziller

Add Ctrl+[n,p] Locator keyboard movement shortcuts.

On OS X, Ctrl+n and Ctrl+p, the Emacs bindings for next and previous,
are global throughout the system. In Qt Creator they work for menus,
code completion widget and other places like Vimium plugin, but not
the Locator widget. This change adds that functionality to Locator
too and makes navigating Locator items easier.

Change-Id: Iebce53d55841ba97d35ad2d433b0d9840d5e4137
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 3d59c991
......@@ -351,7 +351,17 @@ void LocatorWidget::updateFilterList()
bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_fileLineEdit && event->type() == QEvent::KeyPress) {
if (obj == m_fileLineEdit && event->type() == QEvent::ShortcutOverride) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
switch (keyEvent->key()) {
case Qt::Key_P:
case Qt::Key_N:
if (keyEvent->modifiers() == Qt::KeyboardModifiers(Utils::HostOsInfo::controlModifier())) {
event->accept();
return true;
}
}
} else if (obj == m_fileLineEdit && event->type() == QEvent::KeyPress) {
if (m_possibleToolTipRequest)
m_possibleToolTipRequest = false;
if (QToolTip::isVisible())
......@@ -385,6 +395,17 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
return true;
}
break;
case Qt::Key_P:
case Qt::Key_N:
if (keyEvent->modifiers() == Qt::KeyboardModifiers(Utils::HostOsInfo::controlModifier()))
{
if (keyEvent->key() == Qt::Key_P)
m_completionList->previous();
else
m_completionList->next();
return true;
}
break;
default:
break;
}
......
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