summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/kernel/qshortcut.cpp6
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp10
2 files changed, 12 insertions, 4 deletions
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index b7857e2b74..db06dce042 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -665,24 +665,22 @@ int QShortcut::id() const
bool QShortcut::event(QEvent *e)
{
Q_D(QShortcut);
- bool handled = false;
if (d->sc_enabled && e->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){
#if QT_CONFIG(whatsthis)
if (QWhatsThis::inWhatsThisMode()) {
QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);
- handled = true;
} else
#endif
if (se->isAmbiguous())
emit activatedAmbiguously();
else
emit activated();
- handled = true;
+ return true;
}
}
- return handled;
+ return QObject::event(e);
}
#endif // QT_NO_SHORTCUT
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 2c9295d995..53753e195a 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -123,6 +123,7 @@ private slots:
void context();
void duplicatedShortcutOverride();
void shortcutToFocusProxy();
+ void deleteLater();
protected:
static Qt::KeyboardModifiers toButtons( int key );
@@ -1305,5 +1306,14 @@ void tst_QShortcut::shortcutToFocusProxy()
QCOMPARE(le.text(), QString());
}
+void tst_QShortcut::deleteLater()
+{
+ QWidget w;
+ QPointer<QShortcut> sc(new QShortcut(QKeySequence(Qt::Key_1), &w));
+ sc->deleteLater();
+ QTRY_VERIFY(!sc);
+}
+
+
QTEST_MAIN(tst_QShortcut)
#include "tst_qshortcut.moc"