From 434c866e1b76c12b3bf3dcdd76a00f4d29aa64d3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 9 Apr 2019 15:31:16 +0200 Subject: QtGui: Use member initialization for QWindowPrivate, QScreenPrivate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the constructors, destructors in favor of member initialization. Change-Id: I323826328fb783ea2cd931c0e6aad45a98a2ebeb Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qscreen_p.h | 18 ++++------ src/gui/kernel/qwindow_p.h | 85 ++++++++++++++-------------------------------- 2 files changed, 31 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index 8e81c7bf87..e5988ff829 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -64,12 +64,6 @@ class QScreenPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QScreen) public: - QScreenPrivate() - : platformScreen(nullptr) - , orientationUpdateMask(nullptr) - { - } - void setPlatformScreen(QPlatformScreen *screen); void updateHighDpi() { @@ -79,16 +73,16 @@ public: void updatePrimaryOrientation(); - QPlatformScreen *platformScreen; + QPlatformScreen *platformScreen = nullptr; Qt::ScreenOrientations orientationUpdateMask; - Qt::ScreenOrientation orientation; - Qt::ScreenOrientation filteredOrientation; - Qt::ScreenOrientation primaryOrientation; + Qt::ScreenOrientation orientation = Qt::PrimaryOrientation; + Qt::ScreenOrientation filteredOrientation = Qt::PrimaryOrientation; + Qt::ScreenOrientation primaryOrientation = Qt::LandscapeOrientation; QRect geometry; QRect availableGeometry; - QDpi logicalDpi; - qreal refreshRate; + QDpi logicalDpi = {96, 96}; + qreal refreshRate = 60; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index cc1cc24525..d918ed5b52 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -77,45 +77,10 @@ public: QWindowPrivate() : QObjectPrivate() - , surfaceType(QWindow::RasterSurface) - , windowFlags(Qt::Window) - , parentWindow(nullptr) - , platformWindow(nullptr) - , visible(false) - , visibilityOnDestroy(false) - , exposed(false) - , windowState(Qt::WindowNoState) - , visibility(QWindow::Hidden) - , resizeEventPending(true) - , receivedExpose(false) - , positionPolicy(WindowFrameExclusive) - , positionAutomatic(true) - , resizeAutomatic(true) - , contentOrientation(Qt::PrimaryOrientation) - , opacity(qreal(1.0)) - , minimumSize(0, 0) - , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) - , modality(Qt::NonModal) - , blockedByModalWindow(false) - , updateRequestPending(false) - , transientParent(nullptr) - , topLevelScreen(nullptr) -#ifndef QT_NO_CURSOR - , cursor(Qt::ArrowCursor) - , hasCursor(false) -#endif - , compositing(false) -#if QT_CONFIG(vulkan) - , vulkanInstance(nullptr) -#endif { isWindow = true; } - ~QWindowPrivate() - { - } - void init(QScreen *targetScreen = nullptr); void maybeQuitOnLastWindowClosed(); @@ -166,57 +131,57 @@ public: virtual bool allowClickThrough(const QPoint &) const { return true; } - QWindow::SurfaceType surfaceType; - Qt::WindowFlags windowFlags; - QWindow *parentWindow; - QPlatformWindow *platformWindow; - bool visible; - bool visibilityOnDestroy; - bool exposed; + QWindow::SurfaceType surfaceType = QWindow::RasterSurface; + Qt::WindowFlags windowFlags = Qt::Window; + QWindow *parentWindow = nullptr; + QPlatformWindow *platformWindow = nullptr; + bool visible= false; + bool visibilityOnDestroy = false; + bool exposed = false; QSurfaceFormat requestedFormat; QString windowTitle; QString windowFilePath; QIcon windowIcon; QRect geometry; - Qt::WindowStates windowState; - QWindow::Visibility visibility; - bool resizeEventPending; - bool receivedExpose; - PositionPolicy positionPolicy; - bool positionAutomatic; + Qt::WindowStates windowState = Qt::WindowNoState; + QWindow::Visibility visibility = QWindow::Hidden; + bool resizeEventPending = true; + bool receivedExpose = false; + PositionPolicy positionPolicy = WindowFrameExclusive; + bool positionAutomatic = true; // resizeAutomatic suppresses resizing by QPlatformWindow::initialGeometry(). // It also indicates that width/height=0 is acceptable (for example, for // the QRollEffect widget) and is thus not cleared in setGeometry(). // An alternative approach might be using -1,-1 as a default size. - bool resizeAutomatic; - Qt::ScreenOrientation contentOrientation; - qreal opacity; + bool resizeAutomatic = true; + Qt::ScreenOrientation contentOrientation = Qt::PrimaryOrientation; + qreal opacity= 1; QRegion mask; - QSize minimumSize; - QSize maximumSize; + QSize minimumSize = {0, 0}; + QSize maximumSize = {QWINDOWSIZE_MAX, QWINDOWSIZE_MAX}; QSize baseSize; QSize sizeIncrement; - Qt::WindowModality modality; - bool blockedByModalWindow; + Qt::WindowModality modality = Qt::NonModal; + bool blockedByModalWindow = false; - bool updateRequestPending; + bool updateRequestPending = false; bool transientParentPropertySet = false; QPointer transientParent; QPointer topLevelScreen; #ifndef QT_NO_CURSOR - QCursor cursor; - bool hasCursor; + QCursor cursor = {Qt::ArrowCursor}; + bool hasCursor = false; #endif - bool compositing; + bool compositing = false; QElapsedTimer lastComposeTime; #if QT_CONFIG(vulkan) - QVulkanInstance *vulkanInstance; + QVulkanInstance *vulkanInstance = nullptr; #endif }; -- cgit v1.2.3