diff framework/MainWindowBase.cpp @ 168:875a21ad7a95

* 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 2c2029007618
children 5a2845883dd6
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Fri Mar 13 11:06:11 2009 +0000
+++ b/framework/MainWindowBase.cpp	Thu Mar 19 15:50:59 2009 +0000
@@ -90,6 +90,7 @@
 #include <QCheckBox>
 #include <QRegExp>
 #include <QScrollArea>
+#include <QDesktopWidget>
 
 #include <iostream>
 #include <cstdio>
@@ -239,6 +240,16 @@
 }
 
 void
+MainWindowBase::resizeConstrained(QSize size)
+{
+    QDesktopWidget *desktop = QApplication::desktop();
+    QRect available = desktop->availableGeometry();
+    QSize actual(std::min(size.width(), available.width()),
+                 std::min(size.height(), available.height()));
+    resize(actual);
+}
+
+void
 MainWindowBase::oscReady()
 {
     if (m_oscQueue && m_oscQueue->isOK()) {