From d19cfec457da8c286a321dd17297237ad8fa8435 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 3 Apr 2019 19:44:53 +0200 Subject: tell QObject to give the desired children right away Signed-off-by: Rolf Eike Beer --- desktop-widgets/usermanual.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/desktop-widgets/usermanual.cpp b/desktop-widgets/usermanual.cpp index f0a91c175..66262e2ac 100644 --- a/desktop-widgets/usermanual.cpp +++ b/desktop-widgets/usermanual.cpp @@ -129,18 +129,13 @@ void UserManual::linkClickedSlot(const QUrl& url) #ifdef Q_OS_MAC void UserManual::showEvent(QShowEvent *e) { - filterAction = NULL; - closeAction = NULL; MainWindow *m = MainWindow::instance(); - Q_FOREACH (QObject *o, m->children()) { - if (o->objectName() == "actionFilterTags") { - filterAction = qobject_cast(o); - filterAction->setShortcut(QKeySequence()); - } else if (o->objectName() == "actionClose") { - closeAction = qobject_cast(o); - closeAction->setShortcut(QKeySequence()); - } - } + filterAction = m->findChild(QLatin1String("actionFilterTags"), Qt::FindDirectChildrenOnly); + if (filterAction != nullptr) + filterAction->setShortcut(QKeySequence()); + closeAction = m->findChild(QLatin1String("actionClose"), Qt::FindDirectChildrenOnly); + if (closeAction != nullptr) + closeAction->setShortcut(QKeySequence()); } void UserManual::hideEvent(QHideEvent *e) { if (closeAction != NULL) -- cgit v1.2.3-70-g09d2