Commit d087d0b6 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CppEditor: Jump directly to single virtual function

Assumption: model never has 1 entry for immediate result
(there is always the natural result + "Searching for overrides"

Change-Id: I5de7e7933b1309f995a6111a2ab1c7aed31c086e
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 03575317
......@@ -88,6 +88,17 @@ protected:
return GenericProposalWidget::eventFilter(o, e);
}
void showProposal(const QString &prefix)
{
IGenericProposalModel *proposalModel = model();
if (proposalModel && proposalModel->size() == 1) {
emit proposalItemActivated(proposalModel->proposalItem(0));
deleteLater();
return;
}
GenericProposalWidget::showProposal(prefix);
}
private:
QKeySequence m_sequence;
};
......
......@@ -666,6 +666,11 @@ bool GenericProposalWidget::activateCurrentProposalItem()
return false;
}
IGenericProposalModel *GenericProposalWidget::model()
{
return d->m_model;
}
#include "genericproposalwidget.moc"
} // TextEditor
......@@ -37,6 +37,7 @@
namespace TextEditor {
class GenericProposalWidgetPrivate;
class IGenericProposalModel;
class TEXTEDITOR_EXPORT GenericProposalWidget : public IAssistProposalWidget
{
......@@ -72,6 +73,7 @@ private slots:
protected:
bool eventFilter(QObject *o, QEvent *e);
bool activateCurrentProposalItem();
IGenericProposalModel *model();
private:
GenericProposalWidgetPrivate *d;
......
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