Mercurial > octave
changeset 18840:e7b5be5a7f80 gui-release
improve size of the release notes window
* main-window.cc (display_release_notes): calculate the position of the
release notes window with respect to the screen of the main window,
not with respect to the desktop, which may consist of several screens
author | Torsten <ttl@justmail.de> |
---|---|
date | Tue, 17 Jun 2014 20:53:18 +0200 |
parents | 41980d0a5fd2 |
children | b314efd58072 |
files | libgui/src/main-window.cc |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Tue Jun 17 20:51:05 2014 +0200 +++ b/libgui/src/main-window.cc Tue Jun 17 20:53:18 2014 +0200 @@ -369,14 +369,17 @@ release_notes_window->setWindowTitle (tr ("Octave Release Notes")); browser->document()->adjustSize (); - QSize doc_size = browser->document()->size().toSize (); - doc_size.rwidth () += 45; - int h = QApplication::desktop ()->height (); - if (h > 800) - h = 800; - doc_size.rheight () = h; - - release_notes_window->resize (doc_size); + + // center the window on the screen where octave is running + QDesktopWidget *m_desktop = QApplication::desktop (); + int screen = m_desktop->screenNumber (this); // screen of the main window + QRect screen_geo = m_desktop->availableGeometry (screen); + int win_x = screen_geo.width (); // width of the screen + int win_y = screen_geo.height (); // height of the screen + int reln_x = std::min (480, win_x-80); // desired width of release notes + int reln_y = std::min (640, win_y-80); // desired height of release notes + release_notes_window->resize (reln_x, reln_y); // set size + release_notes_window->move (20, 0); // move to the top left corner } if (! release_notes_window->isVisible ())