Implement virtual void QPlatformWindow::setBackingStore()
QWidget re-uses an existing backing store. Platform windows depend on being associated to a backing store, in case they become toplevel windows. If a platform window gets deleted and re-created each time it is shown or hidden, it has to be manually associated to the re-used backing store. This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292. It removes Android specific code from QWidgetPrivate::create(), which has been added to suppress re-using backing stores in the absence of the new API. Fixes: QTBUG-97482 Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit a4ca9e80658bca7dad1529f03c1b59173a6ecf62) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b2004620bd
commit
c5986c9e59
@ -32,6 +32,7 @@ class QScreen;
|
||||
class QWindow;
|
||||
class QIcon;
|
||||
class QRegion;
|
||||
class QPlatformBackingStore;
|
||||
|
||||
class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
|
||||
{
|
||||
@ -117,6 +118,7 @@ public:
|
||||
virtual void requestUpdate();
|
||||
bool hasPendingUpdateRequest() const;
|
||||
virtual void deliverUpdateRequest();
|
||||
virtual void setBackingStore(QPlatformBackingStore *) {}
|
||||
|
||||
// Window property accessors. Platform plugins should use these
|
||||
// instead of accessing QWindow directly.
|
||||
|
@ -47,6 +47,7 @@ bool QFbScreen::event(QEvent *event)
|
||||
|
||||
void QFbScreen::addWindow(QFbWindow *window)
|
||||
{
|
||||
Q_ASSERT(window->backingStore());
|
||||
mWindowStack.prepend(window);
|
||||
if (!mPendingBackingStores.isEmpty()) {
|
||||
//check if we have a backing store for this window
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
#include "qfbwindow_p.h"
|
||||
#include "qfbscreen_p.h"
|
||||
#include "qfbbackingstore_p.h"
|
||||
|
||||
#include <QtGui/QScreen>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformbackingstore.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -111,5 +113,11 @@ void QFbWindow::repaint(const QRegion ®ion)
|
||||
for (auto rect : region)
|
||||
platformScreen()->setDirty(rect.translated(topLeft));
|
||||
}
|
||||
|
||||
void QFbWindow::setBackingStore(QPlatformBackingStore *store)
|
||||
{
|
||||
Q_ASSERT(store);
|
||||
Q_ASSERT_X(dynamic_cast<QFbBackingStore *>(store), __FUNCTION__,
|
||||
"Argument is not a QFbBackingStore.");
|
||||
mBackingStore = static_cast<QFbBackingStore *>(store);
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
|
||||
WId winId() const override { return mWindowId; }
|
||||
|
||||
void setBackingStore(QFbBackingStore *store) { mBackingStore = store; }
|
||||
void setBackingStore(QPlatformBackingStore *store) override;
|
||||
QFbBackingStore *backingStore() const { return mBackingStore; }
|
||||
|
||||
QFbScreen *platformScreen() const;
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include "qandroidplatformwindow.h"
|
||||
#include "qandroidplatformopenglcontext.h"
|
||||
#include "qandroidplatformscreen.h"
|
||||
|
||||
#include "qandroidplatformbackingstore.h"
|
||||
#include "androidjnimain.h"
|
||||
|
||||
#include "qpa/qplatformbackingstore.h"
|
||||
#include <qguiapplication.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
@ -169,4 +169,12 @@ void QAndroidPlatformWindow::applicationStateChanged(Qt::ApplicationState)
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
}
|
||||
|
||||
void QAndroidPlatformWindow::setBackingStore(QPlatformBackingStore *store)
|
||||
{
|
||||
Q_ASSERT(store);
|
||||
Q_ASSERT_X(dynamic_cast<QAndroidPlatformBackingStore *>(store), __FUNCTION__,
|
||||
"Argument is not a QAndroidPlatformBackingStore.");
|
||||
m_backingStore = static_cast<QAndroidPlatformBackingStore *>(store);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
|
||||
virtual void applicationStateChanged(Qt::ApplicationState);
|
||||
|
||||
void setBackingStore(QAndroidPlatformBackingStore *store) { m_backingStore = store; }
|
||||
void setBackingStore(QPlatformBackingStore *store) override;
|
||||
QAndroidPlatformBackingStore *backingStore() const { return m_backingStore; }
|
||||
|
||||
virtual void repaint(const QRegion &) { }
|
||||
|
@ -1332,6 +1332,11 @@ void QWidgetPrivate::create()
|
||||
QBackingStore *store = q->backingStore();
|
||||
usesRhiFlush = false;
|
||||
|
||||
// Re-use backing store, in case a new platform window was created and doesn't know about it.
|
||||
// (e.g. QAndroidPlatformWindow)
|
||||
if (store && q->windowHandle())
|
||||
q->windowHandle()->handle()->setBackingStore(store->handle());
|
||||
|
||||
if (!store) {
|
||||
if (q->windowType() != Qt::Desktop) {
|
||||
if (q->isWindow()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user