Replace backwards Java-style iteration with new reverse_iterators
Faster, and, thanks to the new reverse_iterators, just as convenient. Change-Id: Ibc6c64051a8ede4a47428e9271ffbeaa921fc255 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
80d7b19b80
commit
f9de9eae3a
@ -578,11 +578,8 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
|
|||||||
QString mainPattern;
|
QString mainPattern;
|
||||||
const QString preferredLanguage = QLocale::system().name();
|
const QString preferredLanguage = QLocale::system().name();
|
||||||
|
|
||||||
QListIterator<QString> mimeFilesIter(mimeFiles);
|
for (QStringList::const_reverse_iterator it = mimeFiles.crbegin(), end = mimeFiles.crend(); it != end; ++it) { // global first, then local.
|
||||||
mimeFilesIter.toBack();
|
QFile qfile(*it);
|
||||||
while (mimeFilesIter.hasPrevious()) { // global first, then local.
|
|
||||||
const QString fullPath = mimeFilesIter.previous();
|
|
||||||
QFile qfile(fullPath);
|
|
||||||
if (!qfile.open(QFile::ReadOnly))
|
if (!qfile.open(QFile::ReadOnly))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -192,11 +192,10 @@ void QMenuPrivate::syncPlatformMenu()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QPlatformMenuItem *beforeItem = Q_NULLPTR;
|
QPlatformMenuItem *beforeItem = Q_NULLPTR;
|
||||||
QListIterator<QAction*> it(q->actions());
|
const QList<QAction*> actions = q->actions();
|
||||||
it.toBack();
|
for (QList<QAction*>::const_reverse_iterator it = actions.rbegin(), end = actions.rend(); it != end; ++it) {
|
||||||
while (it.hasPrevious()) {
|
|
||||||
QPlatformMenuItem *menuItem = platformMenu->createMenuItem();
|
QPlatformMenuItem *menuItem = platformMenu->createMenuItem();
|
||||||
QAction *action = it.previous();
|
QAction *action = *it;
|
||||||
menuItem->setTag(reinterpret_cast<quintptr>(action));
|
menuItem->setTag(reinterpret_cast<quintptr>(action));
|
||||||
QObject::connect(menuItem, SIGNAL(activated()), action, SLOT(trigger()), Qt::QueuedConnection);
|
QObject::connect(menuItem, SIGNAL(activated()), action, SLOT(trigger()), Qt::QueuedConnection);
|
||||||
QObject::connect(menuItem, SIGNAL(hovered()), action, SIGNAL(hovered()), Qt::QueuedConnection);
|
QObject::connect(menuItem, SIGNAL(hovered()), action, SIGNAL(hovered()), Qt::QueuedConnection);
|
||||||
|
Loading…
Reference in New Issue
Block a user