QtGui: Use member initialization for QWindowPrivate, QScreenPrivate

Remove the constructors, destructors in favor of member initialization.

Change-Id: I323826328fb783ea2cd931c0e6aad45a98a2ebeb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Friedemann Kleint 2019-04-09 15:31:16 +02:00
parent 0bee05f4c1
commit 434c866e1b
2 changed files with 31 additions and 72 deletions

View File

@ -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

View File

@ -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<QWindow> transientParent;
QPointer<QScreen> 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
};