diff options
author | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2016-11-15 13:10:10 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2016-11-16 13:06:16 +0000 |
commit | 7912ac5d672bef9ab46d05a11fc71cb6ed68acf7 (patch) | |
tree | 2dcf7ba52f3ebd734218479593ae3151d41c1676 /src | |
parent | 3e3b22adeb5267d47ad9aedce9fef816e91197e9 (diff) |
winrt: move to range based loop
Change-Id: I0694adcff9b591eecf1025074e8b1c478484bd74
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp index 038a6d32e8..417dbdc1db 100644 --- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp +++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp @@ -195,8 +195,8 @@ static bool initializeOpenPickerOptions(T *picker, const QSharedPointer<QFileDia ComPtr<IVector<HSTRING>> filters; hr = picker->get_FileTypeFilter(&filters); RETURN_FALSE_IF_FAILED("Failed to get file type filters list"); - foreach (const QString &namedFilter, options->nameFilters()) { - foreach (const QString &filter, QPlatformFileDialogHelper::cleanFilterList(namedFilter)) { + for (const QString &namedFilter : options->nameFilters()) { + for (const QString &filter : QPlatformFileDialogHelper::cleanFilterList(namedFilter)) { // Remove leading star const int offset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0; HStringReference filterRef(reinterpret_cast<const wchar_t *>(filter.utf16() + offset), @@ -419,13 +419,15 @@ bool QWinRTFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit ComPtr<IMap<HSTRING, IVector<HSTRING> *>> choices; hr = picker->get_FileTypeChoices(&choices); RETURN_FALSE_IF_FAILED("Failed to get file extension choices"); - foreach (const QString &namedFilter, dialogOptions->nameFilters()) { + const QStringList nameFilters = dialogOptions->nameFilters(); + for (const QString &namedFilter : nameFilters) { ComPtr<IVector<HSTRING>> entry = Make<WindowsStringVector>(); - foreach (const QString &filter, QPlatformFileDialogHelper::cleanFilterList(namedFilter)) { + const QStringList cleanFilter = QPlatformFileDialogHelper::cleanFilterList(namedFilter); + for (const QString &filter : cleanFilter) { // Remove leading star - const int offset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0; - HStringReference filterRef(reinterpret_cast<const wchar_t *>(filter.utf16() + offset), - filter.length() - offset); + const int starOffset = (filter.length() > 1 && filter.startsWith(QLatin1Char('*'))) ? 1 : 0; + HStringReference filterRef(reinterpret_cast<const wchar_t *>(filter.utf16() + starOffset), + filter.length() - starOffset); hr = entry->Append(filterRef.Get()); if (FAILED(hr)) { qWarning("Failed to add named file filter \"%s\": %s", |