diff options
Diffstat (limited to 'src/widgets/styles/qwindowsstyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 23f886e5b1..f6323bb41c 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -71,6 +71,8 @@ #include <private/qstylehelper_p.h> #include <private/qstyleanimation_p.h> +#include <algorithm> + QT_BEGIN_NAMESPACE #if defined(Q_OS_WIN) @@ -159,12 +161,11 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) // Alt has been pressed - find all widgets that care QList<QWidget *> l = widget->findChildren<QWidget *>(); - for (int pos=0 ; pos < l.size() ; ++pos) { - QWidget *w = l.at(pos); - if (w->isWindow() || !w->isVisible() || - w->style()->styleHint(SH_UnderlineShortcut, 0, w)) - l.removeAt(pos); - } + auto ignorable = [](QWidget *w) { + return w->isWindow() || !w->isVisible() + || w->style()->styleHint(SH_UnderlineShortcut, 0, w); + }; + l.erase(std::remove_if(l.begin(), l.end(), ignorable), l.end()); // Update states before repainting d->seenAlt.append(widget); d->alt_down = true; |