qtquick: When saving geometry, save the QWindow geometry
As that's what we'll restore. The "MainWindow" isn't an actual main window, and it's parented in some QtQuick hierarchy. Will help with issue #196, which isn't fixed yet. Should be fixed in the restore part next.
This commit is contained in:
@@ -713,6 +713,13 @@ LayoutSaver::MainWindow MainWindowBase::serialize() const
|
||||
|
||||
QRect MainWindowBase::windowGeometry() const
|
||||
{
|
||||
// Usually the same as geometry(), unless the this main window is embedded
|
||||
// Returns the window geometry. This is usually the same as MainWindowBase::geometry()
|
||||
// But fixes the following special cases:
|
||||
// - QWidgets: Our MainWindow is embedded in another widget
|
||||
// - QtQuick: Our MainWindow is QQuickItem
|
||||
// Im both cases, what we want is the geometry of the QWindow, for save/restore purposes.
|
||||
if (QWindow *window = windowHandle())
|
||||
return window->geometry();
|
||||
|
||||
return window()->geometry();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user