[libraries/ktextaddons] textaddonswidgets/misc: Minor optimization

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 60959f71b8a802d371fd793789d083a346781e95 by Laurent Montel.
Committed on 31/07/2026 at 19:26.
Pushed by mlaurent into branch 'master'.

Minor optimization

M  +8    -5    textaddonswidgets/misc/loaddialogsizeutils.cpp

https://invent.kde.org/libraries/ktextaddons/-/commit/60959f71b8a802d371fd793789d083a346781e95

diff --git a/textaddonswidgets/misc/loaddialogsizeutils.cpp b/textaddonswidgets/misc/loaddialogsizeutils.cpp
index 642a62997..7bddf6d1a 100644
--- a/textaddonswidgets/misc/loaddialogsizeutils.cpp
+++ b/textaddonswidgets/misc/loaddialogsizeutils.cpp
@@ -17,9 +17,12 @@ void TextAddonsWidgets::LoadDialogSizeUtils::loadDialogSizeScaled(QWidget *w, co
         qCWarning(TEXTADDONSWIDGETS_LOG) << "widget is not define or windowHandle not defined. It's a bug";
         return;
     }
-    const qreal scaleFactor = w->windowHandle()->screen()->devicePixelRatio();
-    w->windowHandle()->resize(QSize(width * scaleFactor, height * scaleFactor));
-    const KConfigGroup group(KSharedConfig::openStateConfig(), key);
-    KWindowConfig::restoreWindowSize(w->windowHandle(), group);
-    w->resize(w->windowHandle()->size()); // workaround for QTBUG-40584
+    if (KSharedConfig::openStateConfig()->hasGroup(key)) {
+        const KConfigGroup group(KSharedConfig::openStateConfig(), key);
+        KWindowConfig::restoreWindowSize(w->windowHandle(), group);
+        w->resize(w->windowHandle()->size()); // workaround for QTBUG-40584
+    } else {
+        const qreal scaleFactor = w->windowHandle()->screen()->devicePixelRatio();
+        w->windowHandle()->resize(QSize(width * scaleFactor, height * scaleFactor));
+    }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.