Commit 3bb71243 authored by mae's avatar mae
Browse files

Fix ambiguous shortcut problems

The dummy shortcut eater did not always work, we sometimes do have
mutual exclusive shortcuts in the same context.

The current solution is simpler: ignore text input when the control modifier
is used. This seems to be in line with other toolkits and applications.

Done with: thorbjorn
parent 29051539
......@@ -425,11 +425,8 @@ QKeySequence Action::keySequence() const
OverrideableAction::OverrideableAction(int id)
: Action(id), m_currentAction(0), m_active(false),
m_contextInitialized(false),
m_dummyShortcutEater(this)
m_contextInitialized(false)
{
Core::ICore::instance()->mainWindow()->addAction(&m_dummyShortcutEater);
m_dummyShortcutEater.setEnabled(false);
}
void OverrideableAction::setAction(QAction *action)
......@@ -473,7 +470,6 @@ bool OverrideableAction::setCurrentContext(const QList<int> &context)
if (hasAttribute(CA_Hide))
m_action->setVisible(false);
m_action->setEnabled(false);
m_dummyShortcutEater.setEnabled(false);
m_active = false;
return false;
}
......@@ -527,9 +523,6 @@ void OverrideableAction::actionChanged()
m_action->setEnabled(m_currentAction->isEnabled());
m_action->setVisible(m_currentAction->isVisible());
m_dummyShortcutEater.setShortcuts(m_action->shortcuts());
m_dummyShortcutEater.setEnabled(m_action->isVisible() && !m_action->isEnabled());
}
bool OverrideableAction::isActive() const
......
......@@ -153,7 +153,6 @@ private:
QMap<int, QPointer<QAction> > m_contextActionMap;
bool m_active;
bool m_contextInitialized;
QAction m_dummyShortcutEater;
};
} // namespace Internal
......
......@@ -1176,7 +1176,7 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
if (ro || e->text().isEmpty() || !e->text().at(0).isPrint()) {
QPlainTextEdit::keyPressEvent(e);
} else {
} else if ((e->modifiers() & Qt::ControlModifier) != Qt::ControlModifier){
QTextCursor cursor = textCursor();
QString text = e->text();
QString autoText = autoComplete(cursor, text);
......
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