summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-03 14:34:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-06 08:34:00 +0000
commit43af54c2282a433f53675604cf76b646ae241a1c (patch)
treeccdfe840c7bef35cb3b3e2dd570d74d63bf73b4e /src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
parent67b296e249883e559bab7edcd8360ca702e18fe9 (diff)
Windows QPA: Fix some clang-tidy-warnings
- Replace index-based loops by range-based for - Change else if to if after return/break/continue or simplify - Fix indentation - Do not check for non-null before invoking delete on pointer - Use isEmpty() instead size() to check for empty containers - Remove C-style casts - Use raw string literal - Do not repeat type in return, use {} instead - Reference local variables by const ref where applicable Change-Id: I5cc4b4026a10bddb561ba1ba8ec137e0d4119f94 Reviewed-by: Miguel Costa <miguel.costa@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 40ab2a4dd2..635033b43f 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -364,7 +364,7 @@ static BOOL QT_WIN_CALLBACK findDialogEnumWindowsProc(HWND hwnd, LPARAM lParam)
wchar_t buf[256];
if (!RealGetWindowClass(hwnd, buf, sizeof(buf)/sizeof(wchar_t)) || buf[0] != L'#')
return TRUE;
- if (!GetWindowTextW(hwnd, buf, sizeof(buf)/sizeof(wchar_t)) || wcscmp(buf, context->title.data()))
+ if (!GetWindowTextW(hwnd, buf, sizeof(buf)/sizeof(wchar_t)) || wcscmp(buf, context->title.data()) != 0)
return TRUE;
context->hwnd = hwnd;
return FALSE;
@@ -1545,8 +1545,8 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
result->updateDirectory();
result->updateSelectedNameFilter();
const QList<QUrl> initialSelection = opts->initiallySelectedFiles();
- if (initialSelection.size() > 0) {
- const QUrl url = initialSelection.front();
+ if (!initialSelection.empty()) {
+ const QUrl &url = initialSelection.constFirst();
if (url.isLocalFile()) {
QFileInfo info(url.toLocalFile());
if (!info.isDir())
@@ -1698,7 +1698,7 @@ void QWindowsXpNativeFileDialog::doExec(HWND owner)
const QStringList nameFilters = m_options->nameFilters();
if (selectedFilterIndex >= 0 && selectedFilterIndex < nameFilters.size())
m_data.setSelectedNameFilter(nameFilters.at(selectedFilterIndex));
- QUrl firstFile = selectedFiles.front();
+ const QUrl &firstFile = selectedFiles.constFirst();
m_data.setDirectory(firstFile.adjusted(QUrl::RemoveFilename));
m_result = QPlatformDialogHelper::Accepted;
emit accepted();
@@ -1727,7 +1727,7 @@ int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM
switch (uMsg) {
case BFFM_INITIALIZED: {
if (!m_title.isEmpty())
- SetWindowText(hwnd, (wchar_t *)m_title.utf16());
+ SetWindowText(hwnd, reinterpret_cast<const wchar_t *>(m_title.utf16()));
const QString initialFile = QDir::toNativeSeparators(m_data.directory().toLocalFile());
if (!initialFile.isEmpty())
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initialFile.utf16()));