Android/QtView: Move resizing of the QWindow to Qt thread
Since any window resize events originating from Qt side are ran in the Qt thread, having the one originating from Android run in the Android thread can lead to race conditions especially during orientation changes. Pick-to: 6.7 Change-Id: Iebebec2fffdaf9181b01fc1e8f539c7bc232996d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>bb10
parent
d45ce58778
commit
02bab22fde
|
|
@ -49,11 +49,13 @@ namespace QtAndroidWindowEmbedding {
|
|||
|
||||
void resizeWindow(JNIEnv *, jclass, jlong windowRef, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
QWindow *window = reinterpret_cast<QWindow*>(windowRef);
|
||||
QWindow *parent = window->parent();
|
||||
if (parent)
|
||||
parent->setGeometry(x, y, width, height);
|
||||
window->setGeometry(0, 0, width, height);
|
||||
QMetaObject::invokeMethod(qApp, [windowRef, x, y, width, height] {
|
||||
QWindow *window = reinterpret_cast<QWindow*>(windowRef);
|
||||
QWindow *parent = window->parent();
|
||||
if (parent)
|
||||
parent->setGeometry(x, y, width, height);
|
||||
window->setGeometry(0, 0, width, height);
|
||||
});
|
||||
}
|
||||
|
||||
bool registerNatives(QJniEnvironment& env) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue