From 9ef93fa153e9093f7b1b9c901192dcf8282b6c3d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Nov 2016 15:48:34 +0100 Subject: Windows QPA plugin: Use member initialization Use C++ 11 member initialization in value-type structs. Task-number: QTBUG-51673 Change-Id: I668389b4a0ad1d862a505b740d67357cb9c2a3dc Reviewed-by: Maurice Kalinowski --- .../platforms/windows/qwindowsclipboard.cpp | 3 +- src/plugins/platforms/windows/qwindowsclipboard.h | 8 ++--- src/plugins/platforms/windows/qwindowscontext.cpp | 31 ++++---------------- src/plugins/platforms/windows/qwindowscontext.h | 34 ++++++++++------------ .../platforms/windows/qwindowsdialoghelpers.cpp | 26 +++++------------ .../platforms/windows/qwindowsdialoghelpers.h | 8 ++--- src/plugins/platforms/windows/qwindowsdrag.cpp | 8 ++--- src/plugins/platforms/windows/qwindowsdrag.h | 10 +++---- .../platforms/windows/qwindowseglcontext.cpp | 2 -- src/plugins/platforms/windows/qwindowseglcontext.h | 4 +-- .../platforms/windows/qwindowsglcontext.cpp | 7 ----- src/plugins/platforms/windows/qwindowsglcontext.h | 15 +++++----- .../platforms/windows/qwindowsinputcontext.cpp | 7 ----- .../platforms/windows/qwindowsinputcontext.h | 14 ++++----- .../platforms/windows/qwindowsintegration.cpp | 6 ++-- .../platforms/windows/qwindowskeymapper.cpp | 4 +-- src/plugins/platforms/windows/qwindowsmime.cpp | 4 +-- src/plugins/platforms/windows/qwindowsmime.h | 2 +- .../platforms/windows/qwindowsmousehandler.cpp | 9 +----- src/plugins/platforms/windows/qwindowsole.cpp | 11 +++---- src/plugins/platforms/windows/qwindowsole.h | 12 ++++---- .../platforms/windows/qwindowsopengltester.h | 10 +++---- src/plugins/platforms/windows/qwindowsscreen.cpp | 12 +------- src/plugins/platforms/windows/qwindowsscreen.h | 20 ++++++------- .../platforms/windows/qwindowssessionmanager.cpp | 3 -- .../platforms/windows/qwindowssessionmanager.h | 6 ++-- .../platforms/windows/qwindowstabletsupport.h | 21 ++++++------- src/plugins/platforms/windows/qwindowswindow.cpp | 15 ++-------- src/plugins/platforms/windows/qwindowswindow.h | 32 ++++++++++---------- 29 files changed, 120 insertions(+), 224 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index d4a7e27762..11cd1756e6 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -149,8 +149,7 @@ static void cleanClipboardPostRoutine() QWindowsClipboard *QWindowsClipboard::m_instance = 0; -QWindowsClipboard::QWindowsClipboard() : - m_data(0), m_clipboardViewer(0), m_nextClipboardViewer(0), m_formatListenerRegistered(false) +QWindowsClipboard::QWindowsClipboard() { QWindowsClipboard::m_instance = this; qAddPostRoutine(cleanClipboardPostRoutine); diff --git a/src/plugins/platforms/windows/qwindowsclipboard.h b/src/plugins/platforms/windows/qwindowsclipboard.h index 3fe0c74e78..3d9a70ea57 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.h +++ b/src/plugins/platforms/windows/qwindowsclipboard.h @@ -83,10 +83,10 @@ private: static QWindowsClipboard *m_instance; QWindowsClipboardRetrievalMimeData m_retrievalData; - QWindowsOleDataObject *m_data; - HWND m_clipboardViewer; - HWND m_nextClipboardViewer; - bool m_formatListenerRegistered; + QWindowsOleDataObject *m_data = nullptr; + HWND m_clipboardViewer = 0; + HWND m_nextClipboardViewer = 0; + bool m_formatListenerRegistered = false; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 20aa7e7f89..4248d5685e 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -165,15 +165,6 @@ static bool enableNonClientDpiScaling(HWND hwnd) \internal \ingroup qt-lighthouse-win */ -QWindowsUser32DLL::QWindowsUser32DLL() : - isTouchWindow(0), - registerTouchWindow(0), unregisterTouchWindow(0), - getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0), - addClipboardFormatListener(0), removeClipboardFormatListener(0), - getDisplayAutoRotationPreferences(0), setDisplayAutoRotationPreferences(0), - enableNonClientDpiScaling(0), getWindowDpiAwarenessContext(0), getAwarenessFromDpiAwarenessContext(0) -{ -} void QWindowsUser32DLL::init() { @@ -206,13 +197,6 @@ bool QWindowsUser32DLL::initTouch() return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; } -QWindowsShcoreDLL::QWindowsShcoreDLL() - : getProcessDpiAwareness(0) - , setProcessDpiAwareness(0) - , getDpiForMonitor(0) -{ -} - void QWindowsShcoreDLL::init() { if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) @@ -241,14 +225,13 @@ QWindowsContext *QWindowsContext::m_instance = 0; typedef QHash HandleBaseWindowHash; struct QWindowsContextPrivate { - QWindowsContextPrivate(); - unsigned m_systemInfo; + unsigned m_systemInfo = 0; QSet m_registeredWindowClassNames; HandleBaseWindowHash m_windows; - HDC m_displayContext; - int m_defaultDPI; + HDC m_displayContext = 0; + int m_defaultDPI = 96; QWindowsKeyMapper m_keyMapper; QWindowsMouseHandler m_mouseHandler; QWindowsMimeConverter m_mimeConverter; @@ -259,15 +242,13 @@ struct QWindowsContextPrivate { #endif const HRESULT m_oleInitializeResult; const QByteArray m_eventType; - QWindow *m_lastActiveWindow; - bool m_asyncExpose; + QWindow *m_lastActiveWindow = nullptr; + bool m_asyncExpose = false; }; QWindowsContextPrivate::QWindowsContextPrivate() - : m_systemInfo(0) - , m_oleInitializeResult(OleInitialize(NULL)) + : m_oleInitializeResult(OleInitialize(NULL)) , m_eventType(QByteArrayLiteral("windows_generic_MSG")) - , m_lastActiveWindow(0), m_asyncExpose(0) { QWindowsContext::user32dll.init(); QWindowsContext::shcoredll.init(); diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 43fde03fa3..b50010321b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -80,7 +80,6 @@ class QTouchDevice; struct QWindowsUser32DLL { - QWindowsUser32DLL(); inline void init(); inline bool initTouch(); @@ -99,32 +98,31 @@ struct QWindowsUser32DLL typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int); // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). - IsTouchWindow isTouchWindow; - RegisterTouchWindow registerTouchWindow; - UnregisterTouchWindow unregisterTouchWindow; - GetTouchInputInfo getTouchInputInfo; - CloseTouchInputHandle closeTouchInputHandle; + IsTouchWindow isTouchWindow = nullptr; + RegisterTouchWindow registerTouchWindow = nullptr; + UnregisterTouchWindow unregisterTouchWindow = nullptr; + GetTouchInputInfo getTouchInputInfo = nullptr; + CloseTouchInputHandle closeTouchInputHandle = nullptr; // Windows Vista onwards - SetProcessDPIAware setProcessDPIAware; + SetProcessDPIAware setProcessDPIAware = nullptr; // Clipboard listeners are present on Windows Vista onwards // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. - AddClipboardFormatListener addClipboardFormatListener; - RemoveClipboardFormatListener removeClipboardFormatListener; + AddClipboardFormatListener addClipboardFormatListener = nullptr; + RemoveClipboardFormatListener removeClipboardFormatListener = nullptr; // Rotation API - GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences; - SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; + GetDisplayAutoRotationPreferences getDisplayAutoRotationPreferences = nullptr; + SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences = nullptr; - EnableNonClientDpiScaling enableNonClientDpiScaling; - GetWindowDpiAwarenessContext getWindowDpiAwarenessContext; - GetAwarenessFromDpiAwarenessContext getAwarenessFromDpiAwarenessContext; + EnableNonClientDpiScaling enableNonClientDpiScaling = nullptr; + GetWindowDpiAwarenessContext getWindowDpiAwarenessContext = nullptr; + GetAwarenessFromDpiAwarenessContext getAwarenessFromDpiAwarenessContext = nullptr; }; // Shell scaling library (Windows 8.1 onwards) struct QWindowsShcoreDLL { - QWindowsShcoreDLL(); void init(); inline bool isValid() const { return getProcessDpiAwareness && setProcessDpiAwareness && getDpiForMonitor; } @@ -132,9 +130,9 @@ struct QWindowsShcoreDLL { typedef HRESULT (WINAPI *SetProcessDpiAwareness)(int); typedef HRESULT (WINAPI *GetDpiForMonitor)(HMONITOR,int,UINT *,UINT *); - GetProcessDpiAwareness getProcessDpiAwareness; - SetProcessDpiAwareness setProcessDpiAwareness; - GetDpiForMonitor getDpiForMonitor; + GetProcessDpiAwareness getProcessDpiAwareness = nullptr; + SetProcessDpiAwareness setProcessDpiAwareness = nullptr; + GetDpiForMonitor getDpiForMonitor = nullptr; }; class QWindowsContext diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 8f1358de6c..fc7c8aee87 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -211,15 +211,6 @@ private: \ingroup qt-lighthouse-win */ -template -QWindowsDialogHelperBase::QWindowsDialogHelperBase() : - m_nativeDialog(0), - m_ownerWindow(0), - m_timerId(0), - m_thread(0) -{ -} - template void QWindowsDialogHelperBase::cleanupThread() { @@ -549,11 +540,11 @@ public: IFACEMETHODIMP OnOverwrite(IFileDialog *, IShellItem *, FDE_OVERWRITE_RESPONSE *) { return S_OK; } QWindowsNativeFileDialogEventHandler(QWindowsNativeFileDialogBase *nativeFileDialog) : - m_ref(1), m_nativeFileDialog(nativeFileDialog) {} + m_nativeFileDialog(nativeFileDialog) {} virtual ~QWindowsNativeFileDialogEventHandler() {} private: - long m_ref; + long m_ref = 1; QWindowsNativeFileDialogBase *m_nativeFileDialog; }; @@ -641,19 +632,18 @@ protected: QWindowsFileDialogSharedData &data() { return m_data; } private: - IFileDialog *m_fileDialog; - IFileDialogEvents *m_dialogEvents; - DWORD m_cookie; + IFileDialog *m_fileDialog = nullptr; + IFileDialogEvents *m_dialogEvents = nullptr; + DWORD m_cookie = 0; QStringList m_nameFilters; - bool m_hideFiltersDetails; - bool m_hasDefaultSuffix; + bool m_hideFiltersDetails = false; + bool m_hasDefaultSuffix = false; QWindowsFileDialogSharedData m_data; QString m_title; }; QWindowsNativeFileDialogBase::QWindowsNativeFileDialogBase(const QWindowsFileDialogSharedData &data) : - m_fileDialog(0), m_dialogEvents(0), m_cookie(0), m_hideFiltersDetails(false), - m_hasDefaultSuffix(false), m_data(data) + m_data(data) { } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index b3101a1419..673e12a31b 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -78,7 +78,7 @@ public: virtual bool supportsNonModalDialog(const QWindow * /* parent */ = 0) const { return true; } protected: - QWindowsDialogHelperBase(); + QWindowsDialogHelperBase() {} QWindowsNativeDialogBase *nativeDialog() const; inline bool hasNativeDialog() const { return m_nativeDialog; } void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; @@ -91,9 +91,9 @@ private: void cleanupThread(); QWindowsNativeDialogBasePtr m_nativeDialog; - HWND m_ownerWindow; - int m_timerId; - QThread *m_thread; + HWND m_ownerWindow = 0; + int m_timerId = 0; + QThread *m_thread = nullptr; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index 9519b509bc..d284c8bf80 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -494,8 +494,7 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect) \ingroup qt-lighthouse-win */ -QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) : - m_refs(1), m_window(w), m_chosenEffect(0), m_lastKeyState(0) +QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) : m_window(w) { qCDebug(lcQpaMime) << __FUNCTION__ << this << w; } @@ -687,10 +686,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, bool QWindowsDrag::m_canceled = false; -QWindowsDrag::QWindowsDrag() : - m_dropDataObject(0), m_cachedDropTargetHelper(0) -{ -} +QWindowsDrag::QWindowsDrag() = default; QWindowsDrag::~QWindowsDrag() { diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h index e81bc7dc61..307a4cfb5e 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.h +++ b/src/plugins/platforms/windows/qwindowsdrag.h @@ -77,12 +77,12 @@ public: private: void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect); - ULONG m_refs; + ULONG m_refs = 1; QWindow *const m_window; QRect m_answerRect; QPoint m_lastPoint; - DWORD m_chosenEffect; - DWORD m_lastKeyState; + DWORD m_chosenEffect = 0; + DWORD m_lastKeyState = 0; }; class QWindowsDrag : public QPlatformDrag @@ -110,9 +110,9 @@ private: static bool m_canceled; QWindowsDropMimeData m_dropData; - IDataObject *m_dropDataObject; + IDataObject *m_dropDataObject = nullptr; - IDropTargetHelper* m_cachedDropTargetHelper; + IDropTargetHelper* m_cachedDropTargetHelper = nullptr; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index a4738dc100..4632c9c157 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -384,8 +384,6 @@ QWindowsEGLContext::QWindowsEGLContext(QWindowsEGLStaticContext *staticContext, QPlatformOpenGLContext *share) : m_staticContext(staticContext) , m_eglDisplay(staticContext->display()) - , m_api(EGL_OPENGL_ES_API) - , m_swapInterval(-1) { if (!m_staticContext) return; diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h index 48a19f81e5..3b636ba17b 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.h +++ b/src/plugins/platforms/windows/qwindowseglcontext.h @@ -167,8 +167,8 @@ private: EGLDisplay m_eglDisplay; EGLConfig m_eglConfig; QSurfaceFormat m_format; - EGLenum m_api; - int m_swapInterval; + EGLenum m_api = EGL_OPENGL_ES_API; + int m_swapInterval = -1; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index c1eb664324..751807e897 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -825,13 +825,6 @@ static inline QOpenGLContextData createDummyWindowOpenGLContextData() \ingroup qt-lighthouse-win */ -QWindowsOpenGLContextFormat::QWindowsOpenGLContextFormat() : - profile(QSurfaceFormat::NoProfile), - version(0), - options(0) -{ -} - QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() { QWindowsOpenGLContextFormat result; diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index 4c804a612e..c2383f76db 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -72,24 +72,23 @@ struct QWindowsOpenGLAdditionalFormat struct QOpenGLContextData { QOpenGLContextData(HGLRC r, HWND h, HDC d) : renderingContext(r), hwnd(h), hdc(d) {} - QOpenGLContextData() : renderingContext(0), hwnd(0), hdc(0) {} + QOpenGLContextData() {} - HGLRC renderingContext; - HWND hwnd; - HDC hdc; + HGLRC renderingContext = 0; + HWND hwnd = 0; + HDC hdc = 0; }; class QOpenGLStaticContext; struct QWindowsOpenGLContextFormat { - QWindowsOpenGLContextFormat(); static QWindowsOpenGLContextFormat current(); void apply(QSurfaceFormat *format) const; - QSurfaceFormat::OpenGLContextProfile profile; - int version; //! majorVersion<<8 + minorVersion - QSurfaceFormat::FormatOptions options; + QSurfaceFormat::OpenGLContextProfile profile = QSurfaceFormat::NoProfile; + int version = 0; //! majorVersion<<8 + minorVersion + QSurfaceFormat::FormatOptions options = 0; }; #ifndef QT_NO_DEBUG_STREAM diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 8adbd494c4..e7ebf73d5d 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -166,15 +166,8 @@ Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id); // from qlocale_win.cpp HIMC QWindowsInputContext::m_defaultContext = 0; -QWindowsInputContext::CompositionContext::CompositionContext() : - hwnd(0), haveCaret(false), position(0), isComposing(false), - factor(1) -{ -} - QWindowsInputContext::QWindowsInputContext() : m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")), - m_endCompositionRecursionGuard(false), m_languageId(currentInputLanguageId()), m_locale(qt_localeFromLCID(m_languageId)) { diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h index a7fa2c4f94..e65a40f031 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.h +++ b/src/plugins/platforms/windows/qwindowsinputcontext.h @@ -57,15 +57,13 @@ class QWindowsInputContext : public QPlatformInputContext struct CompositionContext { - CompositionContext(); - - HWND hwnd; - bool haveCaret; + HWND hwnd = 0; + bool haveCaret = false; QString composition; - int position; - bool isComposing; + int position = 0; + bool isComposing = false; QPointer focusObject; - qreal factor; + qreal factor = 1; }; public: explicit QWindowsInputContext(); @@ -104,7 +102,7 @@ private: const DWORD m_WM_MSIME_MOUSE; static HIMC m_defaultContext; CompositionContext m_compositionContext; - bool m_endCompositionRecursionGuard; + bool m_endCompositionRecursionGuard = false; LCID m_languageId; QLocale m_locale; }; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 004b03d9a9..168bbd1f49 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -128,9 +128,9 @@ struct QWindowsIntegrationPrivate explicit QWindowsIntegrationPrivate(const QStringList ¶mList); ~QWindowsIntegrationPrivate(); - unsigned m_options; + unsigned m_options = 0; QWindowsContext m_context; - QPlatformFontDatabase *m_fontDatabase; + QPlatformFontDatabase *m_fontDatabase = nullptr; #ifndef QT_NO_CLIPBOARD QWindowsClipboard m_clipboard; # ifndef QT_NO_DRAGANDDROP @@ -208,8 +208,6 @@ static inline unsigned parseOptions(const QStringList ¶mList, } QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mList) - : m_options(0) - , m_fontDatabase(0) { Q_INIT_RESOURCE(openglblacklists); diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index b8c4f0b736..1ff447b0c0 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -144,13 +144,11 @@ struct KeyRecord { static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers... struct KeyRecorder { - KeyRecorder() : nrecs(0) {} - inline KeyRecord *findKey(int code, bool remove); inline void storeKey(int code, int ascii, int state, const QString& text); inline void clearKeys(); - int nrecs; + int nrecs = 0; KeyRecord deleted_record; // A copy of last entry removed from records[] KeyRecord records[QT_MAX_KEY_RECORDINGS]; }; diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 30d438a127..bb157d2e5a 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1496,9 +1496,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const \sa QWindowsMime */ -QWindowsMimeConverter::QWindowsMimeConverter() : m_internalMimeCount(0) -{ -} +QWindowsMimeConverter::QWindowsMimeConverter() = default; QWindowsMimeConverter::~QWindowsMimeConverter() { diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h index 4c0cbf9f31..1ed2aa933f 100644 --- a/src/plugins/platforms/windows/qwindowsmime.h +++ b/src/plugins/platforms/windows/qwindowsmime.h @@ -96,7 +96,7 @@ private: void ensureInitialized() const; mutable QList m_mimes; - mutable int m_internalMimeCount; + mutable int m_internalMimeCount = 0; }; #ifndef QT_NO_DEBUG_STREAM diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 3f6230172e..81349f2998 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -185,14 +185,7 @@ static inline QTouchDevice *createTouchDevice() \ingroup qt-lighthouse-win */ -QWindowsMouseHandler::QWindowsMouseHandler() : - m_windowUnderMouse(0), - m_trackedWindow(0), - m_touchDevice(Q_NULLPTR), - m_leftButtonDown(false), - m_previousCaptureWindow(0) -{ -} +QWindowsMouseHandler::QWindowsMouseHandler() = default; QTouchDevice *QWindowsMouseHandler::ensureTouchDevice() { diff --git a/src/plugins/platforms/windows/qwindowsole.cpp b/src/plugins/platforms/windows/qwindowsole.cpp index a1a8c0b499..9b71061aa5 100644 --- a/src/plugins/platforms/windows/qwindowsole.cpp +++ b/src/plugins/platforms/windows/qwindowsole.cpp @@ -74,9 +74,8 @@ QT_BEGIN_NAMESPACE */ QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) : - m_refs(1), data(mimeData), - CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)), - performedEffect(DROPEFFECT_NONE) + data(mimeData), + CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)) { qCDebug(lcQpaMime) << __FUNCTION__ << mimeData->formats(); } @@ -267,8 +266,7 @@ QWindowsOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*) \ingroup qt-lighthouse-win */ -QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &fmtetcs) : - m_dwRefs(1), m_nIndex(0), m_isNull(false) +QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &fmtetcs) { if (QWindowsContext::verbose > 1) qCDebug(lcQpaMime) << __FUNCTION__ << fmtetcs; @@ -285,8 +283,7 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &fmtetcs) } } -QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &lpfmtetcs) : - m_dwRefs(1), m_nIndex(0), m_isNull(false) +QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &lpfmtetcs) { if (QWindowsContext::verbose > 1) qCDebug(lcQpaMime) << __FUNCTION__; diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h index dc31c793e9..643011272b 100644 --- a/src/plugins/platforms/windows/qwindowsole.h +++ b/src/plugins/platforms/windows/qwindowsole.h @@ -82,10 +82,10 @@ public: STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); private: - ULONG m_refs; + ULONG m_refs = 1; QPointer data; - int CF_PERFORMEDDROPEFFECT; - DWORD performedEffect; + const int CF_PERFORMEDDROPEFFECT; + DWORD performedEffect = DROPEFFECT_NONE; }; class QWindowsOleEnumFmtEtc : public IEnumFORMATETC @@ -111,10 +111,10 @@ public: private: bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const; - ULONG m_dwRefs; - ULONG m_nIndex; + ULONG m_dwRefs = 1; + ULONG m_nIndex = 0; QVector m_lpfmtetcs; - bool m_isNull; + bool m_isNull = false; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index 39e20b55d1..e3fec59dd5 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -51,16 +51,14 @@ class QVariant; struct GpuDescription { - GpuDescription() : vendorId(0), deviceId(0), revision(0), subSysId(0) {} - static GpuDescription detect(); QString toString() const; QVariant toVariant() const; - uint vendorId; - uint deviceId; - uint revision; - uint subSysId; + uint vendorId = 0; + uint deviceId = 0; + uint revision = 0; + uint subSysId = 0; QVersionNumber driverVersion; QByteArray driverName; QByteArray description; diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 23d43a95a5..fa2fe6942a 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -56,13 +56,6 @@ QT_BEGIN_NAMESPACE -QWindowsScreenData::QWindowsScreenData() : - dpi(96, 96), depth(32), format(QImage::Format_ARGB32_Premultiplied), - flags(VirtualDesktop), orientation(Qt::LandscapeOrientation), - refreshRateHz(60) -{ -} - static inline QDpi deviceDPI(HDC hdc) { return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); @@ -407,10 +400,7 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy \ingroup qt-lighthouse-win */ -QWindowsScreenManager::QWindowsScreenManager() : - m_lastDepth(-1), m_lastHorizontalResolution(0), m_lastVerticalResolution(0) -{ -} +QWindowsScreenManager::QWindowsScreenManager() = default; /*! \brief Triggers synchronization of screens (WM_DISPLAYCHANGE). diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 02a9dc3bc3..d442ea7131 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -59,18 +59,16 @@ struct QWindowsScreenData LockScreen = 0x4 // Temporary screen existing during user change, etc. }; - QWindowsScreenData(); - QRect geometry; QRect availableGeometry; - QDpi dpi; + QDpi dpi{96, 96}; QSizeF physicalSizeMM; - int depth; - QImage::Format format; - unsigned flags; + int depth = 32; + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + unsigned flags = VirtualDesktop; QString name; - Qt::ScreenOrientation orientation; - qreal refreshRateHz; + Qt::ScreenOrientation orientation = Qt::LandscapeOrientation; + qreal refreshRateHz = 60; }; class QWindowsScreen : public QPlatformScreen @@ -140,9 +138,9 @@ private: void removeScreen(int index); WindowsScreenList m_screens; - int m_lastDepth; - WORD m_lastHorizontalResolution; - WORD m_lastVerticalResolution; + int m_lastDepth = -1; + WORD m_lastHorizontalResolution = 0; + WORD m_lastVerticalResolution = 0; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.cpp b/src/plugins/platforms/windows/qwindowssessionmanager.cpp index 2db9e44388..500fdc750c 100644 --- a/src/plugins/platforms/windows/qwindowssessionmanager.cpp +++ b/src/plugins/platforms/windows/qwindowssessionmanager.cpp @@ -44,9 +44,6 @@ QT_BEGIN_NAMESPACE QWindowsSessionManager::QWindowsSessionManager(const QString &id, const QString &key) : QPlatformSessionManager(id, key) - , m_isActive(false) - , m_blockUserInput(false) - , m_canceled(false) { } diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.h b/src/plugins/platforms/windows/qwindowssessionmanager.h index 25d0636650..7bb7edc523 100644 --- a/src/plugins/platforms/windows/qwindowssessionmanager.h +++ b/src/plugins/platforms/windows/qwindowssessionmanager.h @@ -75,9 +75,9 @@ public: bool isActive() const { return m_isActive;} private: - bool m_isActive; - bool m_blockUserInput; - bool m_canceled; + bool m_isActive = false; + bool m_blockUserInput = false; + bool m_canceled = false; Q_DISABLE_COPY(QWindowsSessionManager) }; diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 2c05dcddfc..97eceaf2cc 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -57,9 +57,6 @@ class QRect; struct QWindowsWinTab32DLL { - QWindowsWinTab32DLL() : wTOpen(0), wTClose(0), wTInfo(0), wTEnable(0), wTOverlap(0), wTPacketsGet(0), wTGet(0), - wTQueueSizeGet(0), wTQueueSizeSet(0) {} - bool init(); typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL); @@ -72,15 +69,15 @@ struct QWindowsWinTab32DLL typedef int (API *PtrWTQueueSizeGet)(HCTX); typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int); - PtrWTOpen wTOpen; - PtrWTClose wTClose; - PtrWTInfo wTInfo; - PtrWTEnable wTEnable; - PtrWTOverlap wTOverlap; - PtrWTPacketsGet wTPacketsGet; - PtrWTGet wTGet; - PtrWTQueueSizeGet wTQueueSizeGet; - PtrWTQueueSizeSet wTQueueSizeSet; + PtrWTOpen wTOpen = nullptr; + PtrWTClose wTClose = nullptr; + PtrWTInfo wTInfo = nullptr; + PtrWTEnable wTEnable = nullptr; + PtrWTOverlap wTOverlap = nullptr; + PtrWTPacketsGet wTPacketsGet = nullptr; + PtrWTGet wTGet = nullptr; + PtrWTQueueSizeGet wTQueueSizeGet = nullptr; + PtrWTQueueSizeSet wTQueueSizeSet = nullptr; }; struct QWindowsTabletDeviceData diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2f7abc6de8..bb5f3a8d75 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -977,9 +977,7 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, DWORD style_, DWORD exStyle_) : geometryHint(w, cm), window(w), style(style_), exStyle(exStyle_), requestedGeometry(geometry), obtainedGeometry(geometry), - margins(QWindowsGeometryHint::frame(style, exStyle)), customMargins(cm), - frameX(CW_USEDEFAULT), frameY(CW_USEDEFAULT), - frameWidth(CW_USEDEFAULT), frameHeight(CW_USEDEFAULT) + margins(QWindowsGeometryHint::frame(style, exStyle)), customMargins(cm) { // Geometry of toplevels does not consider window frames. // TODO: No concept of WA_wasMoved yet that would indicate a @@ -1032,17 +1030,8 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) : QWindowsBaseWindow(aWindow), m_data(data), - m_flags(WithinCreate), - m_hdc(0), - m_windowState(Qt::WindowNoState), - m_opacity(1.0), m_cursor(new CursorHandle), - m_dropTarget(0), - m_savedStyle(0), - m_format(aWindow->requestedFormat()), - m_iconSmall(0), - m_iconBig(0), - m_surface(0) + m_format(aWindow->requestedFormat()) { // Clear the creation context as the window can be found in QWindowsContext's map. QWindowsContext::instance()->setWindowCreationContext(QSharedPointer()); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index dd433a3ca8..fcd8c1f0c9 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -89,22 +89,20 @@ struct QWindowCreationContext QRect obtainedGeometry; QMargins margins; QMargins customMargins; // User-defined, additional frame for WM_NCCALCSIZE - int frameX; // Passed on to CreateWindowEx(), including frame. - int frameY; - int frameWidth; - int frameHeight; + int frameX = CW_USEDEFAULT; // Passed on to CreateWindowEx(), including frame. + int frameY = CW_USEDEFAULT; + int frameWidth = CW_USEDEFAULT; + int frameHeight = CW_USEDEFAULT; }; struct QWindowsWindowData { - QWindowsWindowData() : hwnd(0), embedded(false) {} - Qt::WindowFlags flags; QRect geometry; QMargins frame; // Do not use directly for windows, see FrameDirty. QMargins customMargins; // User-defined, additional frame for NCCALCSIZE - HWND hwnd; - bool embedded; + HWND hwnd = 0; + bool embedded = false; static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData ¶meters, @@ -335,20 +333,20 @@ private: void fireExpose(const QRegion ®ion, bool force=false); mutable QWindowsWindowData m_data; - mutable unsigned m_flags; - HDC m_hdc; - Qt::WindowState m_windowState; - qreal m_opacity; + mutable unsigned m_flags = WithinCreate; + HDC m_hdc = 0; + Qt::WindowState m_windowState = Qt::WindowNoState; + qreal m_opacity = 1; #ifndef QT_NO_CURSOR CursorHandlePtr m_cursor; #endif - QWindowsOleDropTarget *m_dropTarget; - unsigned m_savedStyle; + QWindowsOleDropTarget *m_dropTarget = nullptr; + unsigned m_savedStyle = 0; QRect m_savedFrameGeometry; const QSurfaceFormat m_format; - HICON m_iconSmall; - HICON m_iconBig; - void *m_surface; + HICON m_iconSmall = 0; + HICON m_iconBig = 0; + void *m_surface = nullptr; }; #ifndef QT_NO_DEBUG_STREAM -- cgit v1.2.3