]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix position of toolbar-menu
authorPeter Penz <peter.penz19@gmail.com>
Fri, 10 Jun 2011 14:26:28 +0000 (16:26 +0200)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 10 Jun 2011 14:27:39 +0000 (16:27 +0200)
CCBUG: 274495

src/dolphinmainwindow.cpp

index 4c584cdf9fb2572c94e2fc1eddc8b12dce870846..198e2da773e4ac2fc9d5ce41430bcb46470cfce4 100644 (file)
@@ -2267,20 +2267,18 @@ void ToolBarMenu::showEvent(QShowEvent* event)
     // Assure that the menu is not shown outside the screen boundaries and
     // that it does not overlap with the parent button.
     const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos());
-    if (pos.x() < 0) {
-        pos.rx() = 0;
-    } else if (pos.x() + width() >= screen.width()) {
-        pos.rx() = screen.width() - width();
+    if (pos.x() < screen.x()) {
+        pos.rx() = screen.x();
+    } else if (pos.x() + width() > screen.x() + screen.width()) {
+        pos.rx() = screen.x() + screen.width() - width();
     }
 
-    if (pos.y() < 0) {
-        pos.ry() = 0;
-    } else if (pos.y() + height() >= screen.height()) {
+    if (pos.y() < screen.y()) {
+        pos.ry() = screen.y();
+    } else if (pos.y() + height() > screen.y() + screen.height()) {
         pos.ry() = button->mapToGlobal(QPoint(0, 0)).y() - height();
     }
 
-    pos += screen.topLeft();
-
     move(pos);
 }