aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 6d602a3810..d9ae003504 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -436,12 +436,13 @@ void QQuickWindow::physicalDpiChanged()
void QQuickWindow::handleScreenChanged(QScreen *screen)
{
Q_D(QQuickWindow);
+ // we connected to the initial screen in QQuickWindowPrivate::init, but the screen changed
disconnect(d->physicalDpiChangedConnection);
if (screen) {
physicalDpiChanged();
// When physical DPI changes on the same screen, either the resolution or the device pixel
// ratio changed. We must check what it is. Device pixel ratio does not have its own
- // ...Changed() signal.
+ // ...Changed() signal. Reconnect, same as in QQuickWindowPrivate::init.
d->physicalDpiChangedConnection = connect(screen, &QScreen::physicalDotsPerInchChanged,
this, &QQuickWindow::physicalDpiChanged);
}
@@ -764,8 +765,13 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
Q_ASSERT(windowManager || renderControl);
- if (QScreen *screen = q->screen())
- devicePixelRatio = screen->devicePixelRatio();
+ if (QScreen *screen = q->screen()) {
+ devicePixelRatio = screen->devicePixelRatio();
+ // if the screen changes, then QQuickWindow::handleScreenChanged disconnects
+ // and connects to the new screen
+ physicalDpiChangedConnection = QObject::connect(screen, &QScreen::physicalDotsPerInchChanged,
+ q, &QQuickWindow::physicalDpiChanged);
+ }
QSGContext *sg;
if (renderControl) {
@@ -869,16 +875,16 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
/*!
\qmltype Window
\instantiates QQuickWindow
- \inqmlmodule QtQuick.Window
+ \inqmlmodule QtQuick
\ingroup qtquick-visual
\brief Creates a new top-level window.
The Window object creates a new top-level window for a Qt Quick scene. It automatically sets up the
- window for use with \c {QtQuick 2.x} graphical types.
+ window for use with \c {QtQuick} graphical types.
To use this type, you will need to import the module with the following line:
\code
- import QtQuick.Window 2.2
+ import QtQuick
\endcode
Omitting this import will allow you to have a QML environment without
@@ -1370,7 +1376,12 @@ bool QQuickWindow::event(QEvent *e)
if (danpit == deliveryAgentsNeedingPoints.end()) {
deliveryAgentsNeedingPoints.insert(ptda, QList<QEventPoint>() << pt);
} else {
- danpit.value().append(pt);
+ auto &ptList = danpit.value();
+ auto ptid = pt.id();
+ auto alreadyThere = std::find_if(ptList.constBegin(), ptList.constEnd(),
+ [ptid] (const QEventPoint &pep) { return pep.id() == ptid; });
+ if (alreadyThere == ptList.constEnd())
+ danpit.value().append(pt);
}
};
@@ -1425,8 +1436,6 @@ bool QQuickWindow::event(QEvent *e)
qCDebug(lcPtr) << daAndPoints.first << "shall now receive" << pe;
ret = daAndPoints.first->event(pe) || ret;
}
- if (pe->isAccepted())
- break;
}
if (ret)