diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 3975e423a0..2ac1893256 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -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(q->sender())) + emit q->workAreaResized(QGuiApplication::screens().indexOf(screen)); } QDesktopWidget::QDesktopWidget() diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h index 42c338f696..4bfbf599c1 100644 --- a/src/widgets/kernel/qdesktopwidget.h +++ b/src/widgets/kernel/qdesktopwidget.h @@ -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; diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h index 160807cf23..89c70e53b0 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -75,6 +75,7 @@ class QDesktopWidgetPrivate : public QWidgetPrivate { public: ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } void _q_updateScreens(); + void _q_availableGeometryChanged(); QList screens; };