[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kcmutils] src: Manually resize KCMUtilDialog to sizeHint()
From: Valeriy Malov <null () kde ! org>
Date: 2018-09-12 2:20:33
Message-ID: E1fzuld-00028D-6e () code ! kde ! org
[Download RAW message or body]
Git commit cc4ecfdcd48a52a67f60eb69ed69e91ca42ee405 by Valeriy Malov.
Committed on 12/09/2018 at 02:20.
Pushed by valeriymalov into branch 'master'.
Manually resize KCMUtilDialog to sizeHint()
Summary:
Workaround for https://bugreports.qt.io/browse/QTBUG-3459
Currently adjustSize() is limited to 2/3 of the screen size for windows
This adds unnecessary scrollbars on dialogs that would otherwise fit the
screen
Manually resize the window after adjustSize() happens to avoid this
limitation
CCBUG: 389585
Test Plan:
Tested on a 1366x768 laptop, with this patch networkmanagement window opens
in full screen height (respecting the panel)
Reviewers: #frameworks, ngraham
Reviewed By: ngraham
Subscribers: davidedmundson, acrouthamel, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D15406
M +13 -2 src/kcmultidialog.cpp
https://commits.kde.org/kcmutils/cc4ecfdcd48a52a67f60eb69ed69e91ca42ee405
diff --git a/src/kcmultidialog.cpp b/src/kcmultidialog.cpp
index d5f2f10..2fd7cb8 100644
--- a/src/kcmultidialog.cpp
+++ b/src/kcmultidialog.cpp
@@ -27,8 +27,10 @@
#include "kcmoduleproxy.h"
+#include <QApplication>
#include <QDebug>
#include <QDesktopServices>
+#include <QDesktopWidget>
#include <QProcess>
#include <QPushButton>
#include <QScrollArea>
@@ -261,9 +263,18 @@ KCMultiDialog::~KCMultiDialog()
void KCMultiDialog::showEvent(QShowEvent *ev)
{
- resize(QSize(800, 550));
- adjustSize();
KPageDialog::showEvent(ev);
+ adjustSize();
+ /**
+ * adjustSize() relies on sizeHint but is limited to 2/3 of the desktop size
+ * Workaround for https://bugreports.qt.io/browse/QTBUG-3459
+ *
+ * We adjust the size after passing the show event
+ * because otherwise window pos is set to (0,0)
+ */
+ const QSize maxSize = QApplication::desktop()->availableGeometry(pos()).size();
+ resize(qMin(sizeHint().width(), maxSize.width()),
+ qMin(sizeHint().height(), maxSize.height()));
}
void KCMultiDialog::slotDefaultClicked()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic