changeset 17007:c2e43dd6eb70

Dont display find dialog out of desktop bounds (bug #39518) * libgui/src/m-editor/find-dialog.cc: (find_dialog::find_dialog): Check dialog bounds against desktop dize before settings dialog position.
author John Donoghue <john.donoghue@ieee.org>
date Thu, 18 Jul 2013 12:58:14 -0400
parents 84db9338c448
children 21ed3e2c3be6
files libgui/src/m-editor/find-dialog.cc
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/find-dialog.cc	Thu Jul 18 17:55:53 2013 -0400
+++ b/libgui/src/m-editor/find-dialog.cc	Thu Jul 18 12:58:14 2013 -0400
@@ -158,7 +158,17 @@
   _find_next_button->setDefault (true);
   _find_result_available = false;
 
-  move (p->x() + p->frameGeometry ().width (), p->y());
+  // move to dialog to side of the parent if there is room on the desktop to do so.
+  QWidget * desktop = QApplication::desktop ();
+  int xp = p->x () + p->frameGeometry ().width ();
+  int yp=  p->y ();
+  if (desktop != 0 && sizeHint ().isValid ())
+    {
+      if (xp + sizeHint ().width () > desktop->width ())
+        xp = desktop->width () - sizeHint ().width ();
+    }
+
+  move (xp, yp);
 
 }