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

List:       kde-commits
Subject:    koffice/libs/guiutils
From:       Aron Stansvik <elvstone () gmail ! com>
Date:       2008-05-12 21:40:39
Message-ID: 1210628439.397857.3236.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 807086 by astan:

Make sure the slider popup is not shown outside the screen area


 M  +11 -1     KoSliderCombo.cpp  


--- trunk/koffice/libs/guiutils/KoSliderCombo.cpp #807085:807086
@@ -32,6 +32,7 @@
 #include <QMenu>
 #include <QMouseEvent>
 #include <QDoubleSpinBox>
+#include <QDesktopWidget>
 
 #include <kglobal.h>
 #include <klocale.h>
@@ -171,8 +172,17 @@
 
     QSize popSize = container->size();
     QRect popupRect(thePublic->mapToGlobal(QPoint(arrowPos - hdlPos - slider->x(), \
thePublic->size().height())), popSize); +
+    // Make sure the popup is not drawn outside the screen area
+    QRect screenRect = QApplication::desktop()->availableGeometry(container);
+    if (popupRect.right() > screenRect.right())
+        popupRect.translate(screenRect.right() - popupRect.right(), 0);
+    if (popupRect.left() < screenRect.left())
+        popupRect.translate(screenRect.left() - popupRect.left(), 0);
+    if (popupRect.bottom() > screenRect.bottom())
+        popupRect.translate(0, -(thePublic->height() + container->height()));
+
     container->setGeometry(popupRect);
-
     container->raise();
     container->show();
     slider->setFocus();


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

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