Something like that:
// QTime m_time;
// QString m_search;
void MyComboBox
::keyPressEvent(QKeyEvent *event
) {
if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down /* || ... */)
else
{
if (m_time.elapsed() > 10)
m_search.clear();
m_search.append(event->text());
m_time.restart();
performSearch(); // handles the selection chance of the box according to m_search via setting the querymodel or use QComboBox::findText
}
}
// QTime m_time;
// QString m_search;
void MyComboBox::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down /* || ... */)
QComboBox::keyPressEvent(event);
else
{
if (m_time.elapsed() > 10)
m_search.clear();
m_search.append(event->text());
m_time.restart();
performSearch(); // handles the selection chance of the box according to m_search via setting the querymodel or use QComboBox::findText
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks