forked from qt-creator/qt-creator
Utils: Introduce CompletingLineEdit
* Works around QTCREATORBUG-9453 * Triggers completion on Key_Down with empty prefix * Replace current filters in HistoryCompleter and FancyLineEdit Change-Id: I56bfd4e0ee969c5ae674de2f2de1081fcf6dc176 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
77b766400e
commit
6c78cb303e
@@ -121,7 +121,7 @@ bool FancyLineEditPrivate::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
// --------- FancyLineEdit
|
||||
FancyLineEdit::FancyLineEdit(QWidget *parent) :
|
||||
QLineEdit(parent),
|
||||
CompletingLineEdit(parent),
|
||||
d(new FancyLineEditPrivate(this))
|
||||
{
|
||||
ensurePolished();
|
||||
@@ -222,20 +222,6 @@ void FancyLineEdit::resizeEvent(QResizeEvent *)
|
||||
updateButtonPositions();
|
||||
}
|
||||
|
||||
bool FancyLineEdit::event(QEvent *e)
|
||||
{
|
||||
// workaround for QTCREATORBUG-9453
|
||||
if (e->type() == QEvent::ShortcutOverride && completer()
|
||||
&& completer()->popup() && completer()->popup()->isVisible()) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ke->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QLineEdit::event(e);
|
||||
}
|
||||
|
||||
void FancyLineEdit::setButtonPixmap(Side side, const QPixmap &buttonPixmap)
|
||||
{
|
||||
d->m_iconbutton[side]->setPixmap(buttonPixmap);
|
||||
|
||||
Reference in New Issue
Block a user