Fix emission of QDesktopWidget::workAreaResized().

Connect to QScreen::availableGeometryChanged().

Task-number: QTBUG-32567
Change-Id: I2097d80faa83ae062f7e149122fba26d23432e95
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Friedemann Kleint 2014-09-03 16:10:47 +02:00
parent 4918623f76
commit a6316e6e74
3 changed files with 12 additions and 3 deletions

View File

@ -97,6 +97,8 @@ void QDesktopWidgetPrivate::_q_updateScreens()
screenWidget->setGeometry(qScreen->geometry());
QObject::connect(qScreen, SIGNAL(geometryChanged(QRect)),
q, SLOT(_q_updateScreens()), Qt::QueuedConnection);
QObject::connect(qScreen, SIGNAL(availableGeometryChanged(QRect)),
q, SLOT(_q_availableGeometryChanged()), Qt::QueuedConnection);
QObject::connect(qScreen, SIGNAL(destroyed()),
q, SLOT(_q_updateScreens()), Qt::QueuedConnection);
screens.append(screenWidget);
@ -122,10 +124,15 @@ void QDesktopWidgetPrivate::_q_updateScreens()
if (oldLength != targetLength)
emit q->screenCountChanged(targetLength);
foreach (int changedScreen, changedScreens) {
foreach (int changedScreen, changedScreens)
emit q->resized(changedScreen);
emit q->workAreaResized(changedScreen);
}
}
void QDesktopWidgetPrivate::_q_availableGeometryChanged()
{
Q_Q(QDesktopWidget);
if (QScreen *screen = qobject_cast<QScreen *>(q->sender()))
emit q->workAreaResized(QGuiApplication::screens().indexOf(screen));
}
QDesktopWidget::QDesktopWidget()

View File

@ -93,6 +93,7 @@ private:
Q_DISABLE_COPY(QDesktopWidget)
Q_DECLARE_PRIVATE(QDesktopWidget)
Q_PRIVATE_SLOT(d_func(), void _q_updateScreens())
Q_PRIVATE_SLOT(d_func(), void _q_availableGeometryChanged())
friend class QApplication;
friend class QApplicationPrivate;

View File

@ -75,6 +75,7 @@ class QDesktopWidgetPrivate : public QWidgetPrivate {
public:
~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; }
void _q_updateScreens();
void _q_availableGeometryChanged();
QList<QDesktopScreenWidget *> screens;
};