[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kgoldrunner] src: BUG: 329575 Prevent game selector dialog from spilling into the Taskbar.
From:       Ian Wadham <iandw.au () gmail ! com>
Date:       2014-01-06 5:18:28
Message-ID: E1W02a4-0002wr-2a () scm ! kde ! org
[Download RAW message or body]

Git commit 71d0d39604c33502d1f1df186fa75eb3789fe397 by Ian Wadham.
Committed on 06/01/2014 at 05:12.
Pushed by ianw into branch 'master'.

BUG: 329575 Prevent game selector dialog from spilling into the Taskbar.

M  +10   -0    src/kgrselector.cpp

http://commits.kde.org/kgoldrunner/71d0d39604c33502d1f1df186fa75eb3789fe397

diff --git a/src/kgrselector.cpp b/src/kgrselector.cpp
index d5afbee..ec3d702 100644
--- a/src/kgrselector.cpp
+++ b/src/kgrselector.cpp
@@ -37,6 +37,9 @@
 
 #include <QPainter>
 
+#include <QApplication>
+#include <QDesktopWidget>
+
 #include <KGlobalSettings>
 #include <KConfigGroup>
 #include <KIntNumInput>
@@ -225,6 +228,13 @@ void KGrSLDialog::setupWidgets()
     int cell =  slParent->width() / (FIELDWIDTH + 4);
     dad->	setMinimumSize ((FIELDWIDTH*cell/2), (FIELDHEIGHT-3)*cell);
 
+    // Avoid spilling into the Taskbar or Apple Dock area if they get too close.
+    // Otherwise allow the dialog to choose its size and then be resizeable.
+    const QRect avail = QApplication::desktop()->availableGeometry(this);
+    if ((avail.height() - slParent->height()) <= 120) {
+        dad->setFixedHeight (slParent->height() - 120);	// Keep 120 for buttons.
+    }
+
     // Set the default for the level-number in the scrollbar.
     number->	setTracking (true);
     number->setValue (defaultLevel);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic