Android: eradicate Q_FOREACH loops [rvalues]
... by replacing them with C++11 range-for loops. This is the simplest of the patch series: Q_FOREACH took a copy, so we do, too. Except we don't, since we're just catching the return value that comes out of the function (RVO). We can't feed the rvalues into range-for, because they are non-const and would thus detach. Change-Id: Ia086b1f3d072dd56c3545780490be03346df2880 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
parent
3010c38713
commit
0d19a571cd
@ -275,7 +275,8 @@ void QAndroidBearerEngine::updateConfigurations()
|
||||
interfaces = QNetworkInterface::allInterfaces();
|
||||
|
||||
// Create a configuration for each of the main types (WiFi, Mobile, Bluetooth, WiMax, Ethernet)
|
||||
foreach (const AndroidNetworkInfo &netInfo, m_connectivityManager->getAllNetworkInfo()) {
|
||||
const auto netInfos = m_connectivityManager->getAllNetworkInfo();
|
||||
for (const AndroidNetworkInfo &netInfo : netInfos) {
|
||||
|
||||
if (!netInfo.isValid())
|
||||
continue;
|
||||
|
@ -627,7 +627,8 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
|
||||
return;
|
||||
|
||||
if (QGuiApplication::instance() != nullptr) {
|
||||
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
|
||||
const auto tlw = QGuiApplication::topLevelWindows();
|
||||
for (QWindow *w : tlw) {
|
||||
QRect availableGeometry = w->screen()->availableGeometry();
|
||||
if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
|
||||
QWindowSystemInterface::handleExposeEvent(w, QRegion(QRect(QPoint(), w->geometry().size())));
|
||||
|
@ -218,7 +218,8 @@ namespace QtAndroidMenu
|
||||
static int addAllMenuItemsToMenu(JNIEnv *env, jobject menu, QAndroidPlatformMenu *platformMenu) {
|
||||
int order = 0;
|
||||
QMutexLocker lock(platformMenu->menuItemsMutex());
|
||||
foreach (QAndroidPlatformMenuItem *item, platformMenu->menuItems()) {
|
||||
const auto items = platformMenu->menuItems();
|
||||
for (QAndroidPlatformMenuItem *item : items) {
|
||||
if (item->isSeparator())
|
||||
continue;
|
||||
QString itemText = removeAmpersandEscapes(item->text());
|
||||
|
@ -62,7 +62,8 @@ void QAndroidPlatformFontDatabase::populateFontDatabase()
|
||||
nameFilters << QLatin1String("*.ttf")
|
||||
<< QLatin1String("*.otf");
|
||||
|
||||
foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) {
|
||||
const auto entries = dir.entryInfoList(nameFilters, QDir::Files);
|
||||
for (const QFileInfo &fi : entries) {
|
||||
const QByteArray file = QFile::encodeName(fi.absoluteFilePath());
|
||||
QBasicFontDatabase::addTTFile(QByteArray(), file);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user