diff options
author | David Faure <david.faure@kdab.com> | 2014-01-30 10:29:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-08 10:53:14 +0100 |
commit | fc060c472d728a681f623ce17676078c8262bc7e (patch) | |
tree | 847f940ead367d852c4fd183d493b423ea5e448f /src/gui/kernel/qwindow.cpp | |
parent | 9db6c67f5ce375ff14ad7576b67c6e96bc73b080 (diff) |
QWindow: reduce a bit of code duplication.
Makes it easier to add code in the future too.
No-op change.
Change-Id: I228c36813ccf8ee95ed4b6cbbc20af3178d1b84a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4c74a0b834..b676df3b85 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -163,9 +163,7 @@ QWindow::QWindow(QScreen *targetScreen) //if your applications aborts here, then chances are your creating a QWindow before the //screen list is populated. Q_ASSERT(d->screen); - - connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); - QGuiApplicationPrivate::window_list.prepend(this); + d->init(); } /*! @@ -188,8 +186,7 @@ QWindow::QWindow(QWindow *parent) d->screen = parent->screen(); if (!d->screen) d->screen = QGuiApplication::primaryScreen(); - connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); - QGuiApplicationPrivate::window_list.prepend(this); + d->init(); } /*! @@ -214,8 +211,7 @@ QWindow::QWindow(QWindowPrivate &dd, QWindow *parent) d->screen = parent->screen(); if (!d->screen) d->screen = QGuiApplication::primaryScreen(); - connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*))); - QGuiApplicationPrivate::window_list.prepend(this); + d->init(); } /*! @@ -233,6 +229,13 @@ QWindow::~QWindow() destroy(); } +void QWindowPrivate::init() +{ + Q_Q(QWindow); + QObject::connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*))); + QGuiApplicationPrivate::window_list.prepend(q); +} + /*! \enum QWindow::Visibility \since 5.1 |