summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <[email protected]>2023-01-05 03:17:55 +0100
committerGiuseppe D'Angelo <[email protected]>2023-01-23 15:51:55 +0100
commit3d8e02152a4c83a45f616dcad6852bc71fc3996d (patch)
tree91e52c1a2435de8e20c52dde3f3944c5584786e3
parentc155216917ff583bcab3d0ec5b59099af3fbea0d (diff)
Windows QPA: use make_unique instead of QSP+raw new+memset
A minimal change here would've been just to use value initialization instead of default initialization. But just go for the kill -- stop using QScopedPointer. Change-Id: Ie427a44d13987c2b4a2c881c350df04e935df9d8 Reviewed-by: Yuhang Zhao <[email protected]> Reviewed-by: Oliver Wolff <[email protected]>
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 28c88ab7165..ceb33f6141c 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -16,7 +16,8 @@
#include <QtGui/qcursor.h>
#include <QtCore/qdebug.h>
-#include <QtCore/qscopedpointer.h>
+
+#include <memory>
#include <windowsx.h>
@@ -577,15 +578,14 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
const QRect screenGeometry = screen->geometry();
const int winTouchPointCount = int(msg.wParam);
- QScopedArrayPointer<TOUCHINPUT> winTouchInputs(new TOUCHINPUT[winTouchPointCount]);
- memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * size_t(winTouchPointCount));
+ const auto winTouchInputs = std::make_unique<TOUCHINPUT[]>(winTouchPointCount);
QTouchPointList touchPoints;
touchPoints.reserve(winTouchPointCount);
QEventPoint::States allStates;
GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(msg.lParam),
- UINT(msg.wParam), winTouchInputs.data(), sizeof(TOUCHINPUT));
+ UINT(msg.wParam), winTouchInputs.get(), sizeof(TOUCHINPUT));
for (int i = 0; i < winTouchPointCount; ++i) {
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
int id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);