void ToolbarSearch::focusInEvent(QFocusEvent *event) { SearchLineEdit::focusInEvent(event); // Every time we get a focus in event QLineEdit re-connects... disconnect(completer(), SIGNAL(activated(QString)), this, SLOT(setText(QString))); disconnect(completer(), SIGNAL(highlighted(QString)), this, SLOT(_q_completionHighlighted(QString))); }
void ExLineEdit::focusOutEvent(QFocusEvent *event) { m_lineEdit->event(event); if (m_lineEdit->completer()) { connect(m_lineEdit->completer(), SIGNAL(activated(QString)), m_lineEdit, SLOT(setText(QString))); connect(m_lineEdit->completer(), SIGNAL(highlighted(QString)), m_lineEdit, SLOT(_q_completionHighlighted(QString))); } QWidget::focusOutEvent(event); }