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>bb10
parent
9db6c67f5c
commit
fc060c472d
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
void maybeQuitOnLastWindowClosed();
|
||||
#ifndef QT_NO_CURSOR
|
||||
void setCursor(const QCursor *c = 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue