]> git.cworth.org Git - apitrace/commitdiff
Forgot to add the imageviewer.
authorZack Rusin <zack@kde.org>
Sun, 10 Apr 2011 06:19:59 +0000 (02:19 -0400)
committerZack Rusin <zack@kde.org>
Sun, 10 Apr 2011 06:19:59 +0000 (02:19 -0400)
gui/imageviewer.cpp [new file with mode: 0644]
gui/imageviewer.h [new file with mode: 0644]
gui/ui/imageviewer.ui [new file with mode: 0644]

diff --git a/gui/imageviewer.cpp b/gui/imageviewer.cpp
new file mode 100644 (file)
index 0000000..fd5ec5d
--- /dev/null
@@ -0,0 +1,31 @@
+#include "imageviewer.h"
+
+#include <QPainter>
+#include <QPixmap>
+
+ImageViewer::ImageViewer(QWidget *parent)
+    : QDialog(parent)
+{
+    setupUi(this);
+
+    QPixmap px(32, 32);
+    QPainter p(&px);
+    p.fillRect(0, 0, 32, 32, Qt::white);
+    p.fillRect(0, 0, 16, 16, QColor(193, 193, 193));
+    p.fillRect(16, 16, 16, 16, QColor(193, 193, 193));
+    p.end();
+    QPalette pal = scrollAreaWidgetContents->palette();
+    pal.setBrush(QPalette::Background,
+                 QBrush(px));
+    pal.setBrush(QPalette::Base,
+                 QBrush(px));
+    scrollAreaWidgetContents->setPalette(pal);
+}
+
+void ImageViewer::setImage(const QImage &image)
+{
+    QPixmap px = QPixmap::fromImage(image);
+    imageLabel->setPixmap(px);
+}
+
+#include "imageviewer.moc"
diff --git a/gui/imageviewer.h b/gui/imageviewer.h
new file mode 100644 (file)
index 0000000..05e8f45
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef IMAGEVIEWER_H
+#define IMAGEVIEWER_H
+
+#include "ui_imageviewer.h"
+#include <QDialog>
+
+class ImageViewer : public QDialog, public Ui_ImageViewer
+{
+    Q_OBJECT
+public:
+    ImageViewer(QWidget *parent = 0);
+
+    void setImage(const QImage &image);
+};
+
+
+#endif
diff --git a/gui/ui/imageviewer.ui b/gui/ui/imageviewer.ui
new file mode 100644 (file)
index 0000000..0f126b7
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImageViewer</class>
+ <widget class="QDialog" name="ImageViewer">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>ApiTrace Surface Viewer</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QScrollArea" name="scrollArea">
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>386</width>
+        <height>286</height>
+       </rect>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QLabel" name="imageLabel">
+         <property name="text">
+          <string/>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignCenter</set>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>