Commit 246ea726 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Improve startup sequence

Don't the main window start in the default size and then arrange it into
the saved geometry. Pass the width and height so the object is
constructed with the correct sizes. This should solve some visual
glitches at startup.

BUG: 403682
parent 9d49c268
......@@ -496,4 +496,10 @@ void DiscoverObject::reboot()
interface.asyncCall(QStringLiteral("logout"), 0, 1, 2); // Options: do not ask again | reboot | force
}
QRect DiscoverObject::initialGeometry() const
{
KConfigGroup window(KSharedConfig::openConfig(), "Window");
return window.readEntry("geometry", QRect());
}
#include "DiscoverObject.moc"
......@@ -36,6 +36,8 @@ class DiscoverObject : public QObject
Q_OBJECT
Q_PROPERTY(CompactMode compactMode READ compactMode WRITE setCompactMode NOTIFY compactModeChanged)
Q_PROPERTY(bool isRoot READ isRoot CONSTANT)
Q_PROPERTY(QRect initialGeometry READ initialGeometry CONSTANT)
public:
enum CompactMode { Auto, Compact, Full };
Q_ENUM(CompactMode)
......@@ -59,6 +61,7 @@ class DiscoverObject : public QObject
static bool isRoot();
QWindow* rootObject() const;
void showPassiveNotification(const QString &msg);
QRect initialGeometry() const;
public Q_SLOTS:
void openApplication(const QUrl& app);
......
......@@ -28,6 +28,8 @@ Kirigami.ApplicationWindow
objectName: "DiscoverMainWindow"
title: leftPage ? leftPage.title : ""
width: app.initialGeometry.width>=10 ? app.initialGeometry.width : Kirigami.Units.gridUnit * 45
height: app.initialGeometry.height>=10 ? app.initialGeometry.height : Kirigami.Units.gridUnit * 30
visible: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment