Do not New / Delete the item, use the Stack.

This should be somewhat faster, and the code is cleaner.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-12-19 18:56:43 -02:00 committed by Dirk Hohndel
parent 2ead1ebe08
commit bffceb18e7

View file

@ -183,9 +183,8 @@ void TagWidget::keyPressEvent(QKeyEvent *e) {
} }
} }
if (e->key() == Qt::Key_Tab) { // let's pretend this is a comma instead if (e->key() == Qt::Key_Tab) { // let's pretend this is a comma instead
QKeyEvent *fakeEvent = new QKeyEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(",")); QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
GroupedLineEdit::keyPressEvent(fakeEvent); GroupedLineEdit::keyPressEvent(&fakeEvent);
delete fakeEvent;
} else { } else {
GroupedLineEdit::keyPressEvent(e); GroupedLineEdit::keyPressEvent(e);
} }