comparison main/main.cpp @ 319:cb189d3816e5

* Avoid resizing the window on file load to larger than the available screen size
author Chris Cannam
date Thu, 19 Mar 2009 15:50:59 +0000
parents 8aa8dd8050d9
children 067a57de45e2
comparison
equal deleted inserted replaced
318:75c3ab874c8e 319:cb189d3816e5
319 if (height < 450) height = available.height() * 2 / 3; 319 if (height < 450) height = available.height() * 2 / 3;
320 if (width > height * 2) width = height * 2; 320 if (width > height * 2) width = height * 2;
321 321
322 settings.beginGroup("MainWindow"); 322 settings.beginGroup("MainWindow");
323 QSize size = settings.value("size", QSize(width, height)).toSize(); 323 QSize size = settings.value("size", QSize(width, height)).toSize();
324 gui->resize(size); 324 gui->resizeConstrained(size);
325 if (settings.contains("position")) { 325 if (settings.contains("position")) {
326 QRect prevrect(settings.value("position").toPoint(), size); 326 QRect prevrect(settings.value("position").toPoint(), size);
327 if (!(available & prevrect).isEmpty()) { 327 if (!(available & prevrect).isEmpty()) {
328 gui->move(prevrect.topLeft()); 328 gui->move(prevrect.topLeft());
329 } 329 }