]> git.cworth.org Git - apitrace/commitdiff
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 90e5f2a92262e3e6df7f5bbdb608fb775512bdf5..9a50510ccbfaaeb5ac4bf0e6f6275001b33b795e 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 0f126b7200f59789753fb8c16fae571ed3a91b5d..3ae2dadcb7d6377631d622411932f87d61cb0bac 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">