[libraries/ktextaddons/2.1] textaddonswidgets/misc: Minor optimization

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 19464d92baf3311292e1ac53bfd8a8c7c7af115c by Laurent Montel.
Committed on 02/08/2026 at 06:11.
Pushed by mlaurent into branch '2.1'.

Minor optimization

(cherry picked from commit 60959f71b8a802d371fd793789d083a346781e95)

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

https://invent.kde.org/libraries/ktextaddons/-/commit/19464d92baf3311292e1ac53bfd8a8c7c7af115c

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.