resize the qt window to fill 2/3 of the screen size (no more crammed widgets on first launch) and always center it
authorkoda
Sun, 02 Dec 2012 14:51:54 +0100
changeset 8184 e0c8fad98022
parent 8182 7834c2519070
child 8185 1c3739ba4352
resize the qt window to fill 2/3 of the screen size (no more crammed widgets on first launch) and always center it
QTfrontend/gameuiconfig.cpp
--- a/QTfrontend/gameuiconfig.cpp	Sat Dec 01 19:57:57 2012 -0500
+++ b/QTfrontend/gameuiconfig.cpp	Sun Dec 02 14:51:54 2012 +0100
@@ -179,7 +179,16 @@
 
 void GameUIConfig::resizeToConfigValues()
 {
-    Form->resize(value("frontend/width", 800).toUInt(), value("frontend/height", 600).toUInt());
+    // fill 2/3 of the screen desktop
+    const QRect deskSize = QApplication::desktop()->screenGeometry(-1);
+    Form->resize(value("frontend/width", deskSize.width()*2/3).toUInt(),
+                 value("frontend/height", deskSize.height()*2/3).toUInt());
+
+    // move the window to the center of the screen
+    QPoint center = QApplication::desktop()->availableGeometry(-1).center();
+    center.setX(center.x() - (Form->width()/2));
+    center.setY(center.y() - (Form->height()/2));
+    Form->move(center);
 }
 
 void GameUIConfig::SaveOptions()