QGestureManager: fix one (of many) inefficient loop(s)

I showed QGestureManager to a colleage and I just couldn't avert my
eyes...

Also remove a pointless container::clear() call (the data member's
dtor will do that implicitly).

Change-Id: Id2b3f471d62e5ea416e875f28ecee73f8614a469
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2019-12-26 19:35:55 +01:00
parent 859307d7a5
commit bf330a8f03

View File

@ -105,11 +105,10 @@ QGestureManager::QGestureManager(QObject *parent)
QGestureManager::~QGestureManager()
{
qDeleteAll(m_recognizers);
foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) {
qDeleteAll(m_obsoleteGestures.value(recognizer));
delete recognizer;
for (auto it = m_obsoleteGestures.cbegin(), end = m_obsoleteGestures.cend(); it != end; ++it) {
qDeleteAll(it.value());
delete it.key();
}
m_obsoleteGestures.clear();
}
Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)