Commit 53a0282d authored by Laurent Montel's avatar Laurent Montel
Browse files

Fix dialog size

parent ed282d1c
Pipeline #237053 canceled with stage
in 2 minutes and 58 seconds
......@@ -69,6 +69,7 @@ target_link_libraries(libkdebugsettings
KF5::ItemViews
KF5::ConfigCore
KF5::Completion
KF5::ConfigGui
)
set_target_properties(libkdebugsettings
......
......@@ -8,12 +8,13 @@
#include "groupmanagementdialog.h"
#include "groupmanagementwidget.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
......@@ -44,15 +45,15 @@ GroupManagementDialog::~GroupManagementDialog()
void GroupManagementDialog::readConfig()
{
create(); // ensure a window is created
windowHandle()->resize(QSize(400, 300));
KConfigGroup group(KSharedConfig::openStateConfig(), myGroupManagementDialogGroupName);
const QSize sizeDialog = group.readEntry("Size", QSize(400, 300));
if (sizeDialog.isValid()) {
resize(sizeDialog);
}
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void GroupManagementDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), myGroupManagementDialogGroupName);
group.writeEntry("Size", size());
KWindowConfig::saveWindowSize(windowHandle(), group);
}
......@@ -23,6 +23,7 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QDesktopServices>
#include <QDialogButtonBox>
......@@ -33,6 +34,7 @@
#include <QTabWidget>
#include <QUrl>
#include <QVBoxLayout>
#include <QWindow>
namespace
{
constexpr char KDebugSettingsDialogGroupName[] = "KDebugSettingsDialog";
......@@ -104,18 +106,17 @@ KDebugSettingsDialog::~KDebugSettingsDialog()
void KDebugSettingsDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), QLatin1String(KDebugSettingsDialogGroupName));
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
}
create(); // ensure a window is created
windowHandle()->resize(QSize(600, 300));
KConfigGroup group(KSharedConfig::openStateConfig(), KDebugSettingsDialogGroupName);
KWindowConfig::restoreWindowSize(windowHandle(), group);
resize(windowHandle()->size()); // workaround for QTBUG-40584
}
void KDebugSettingsDialog::saveConfig()
{
KConfigGroup group(KSharedConfig::openStateConfig(), QLatin1String(KDebugSettingsDialogGroupName));
group.writeEntry("Size", size());
group.sync();
KWindowConfig::saveWindowSize(windowHandle(), group);
}
void KDebugSettingsDialog::slotLoadGroup(const QString &fullPath)
......
Supports Markdown
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