diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-03 14:34:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-06 08:34:00 +0000 |
commit | 43af54c2282a433f53675604cf76b646ae241a1c (patch) | |
tree | ccdfe840c7bef35cb3b3e2dd570d74d63bf73b4e /src/plugins/platforms/windows/qwindowscursor.cpp | |
parent | 67b296e249883e559bab7edcd8360ca702e18fe9 (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/qwindowscursor.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscursor.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 0924fb822e..1443e5e920 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -524,10 +524,11 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const } // Load available standard cursors from resources - const QWindowsStandardCursorMapping *sEnd = standardCursors + sizeof(standardCursors) / sizeof(standardCursors[0]); - for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) { - if (s->shape == cursorShape) - return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); + for (const QWindowsStandardCursorMapping &s : standardCursors) { + if (s.shape == cursorShape) { + return static_cast<HCURSOR>(LoadImage(nullptr, s.resource, IMAGE_CURSOR, + 0, 0, LR_DEFAULTSIZE | LR_SHARED)); + } } qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape); |