Size the image widget more reasonably.
authorZack Rusin <zack@kde.org>
Sat, 23 Apr 2011 06:30:29 +0000 (02:30 -0400)
committerZack Rusin <zack@kde.org>
Sat, 23 Apr 2011 06:30:29 +0000 (02:30 -0400)
gui/mainwindow.cpp
gui/ui/imageviewer.ui

index 90e5f2a..9a50510 100644 (file)
 #include "vertexdatainterpreter.h"
 
 #include <QAction>
+#include <QApplication>
 #include <QDebug>
 #include <QDesktopServices>
+#include <QDesktopWidget>
 #include <QDir>
 #include <QFileDialog>
 #include <QLineEdit>
@@ -560,10 +562,13 @@ void MainWindow::showSelectedSurface()
         return;
 
     QVariant var = item->data(0, Qt::UserRole);
-
+    QImage img = var.value<QImage>();
     ImageViewer *viewer = new ImageViewer(this);
     viewer->setAttribute(Qt::WA_DeleteOnClose, true);
-    viewer->setImage(var.value<QImage>());
+    viewer->setImage(img);
+    QRect screenRect = QApplication::desktop()->availableGeometry();
+    viewer->resize(qMin(int(0.75 * screenRect.width()), img.width()) + 40,
+                   qMin(int(0.75 * screenRect.height()), img.height()) + 40);
     viewer->show();
     viewer->raise();
     viewer->activateWindow();
index 0f126b7..3ae2dad 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>825</width>
+    <height>629</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -24,8 +24,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>386</width>
-        <height>286</height>
+        <width>811</width>
+        <height>615</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_2">