Small testing app for DrawMap scene
authorunc0rr
Sat, 27 Nov 2010 23:57:31 +0300
changeset 4425 2314bb0c433d
parent 4424 3225ea34e415
child 4426 969e411c72aa
Small testing app for DrawMap scene
tools/drawMapTest/drawMapTest.pro
tools/drawMapTest/main.cpp
tools/drawMapTest/mainwindow.cpp
tools/drawMapTest/mainwindow.h
tools/drawMapTest/mainwindow.ui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/drawMapTest/drawMapTest.pro	Sat Nov 27 23:57:31 2010 +0300
@@ -0,0 +1,11 @@
+# -------------------------------------------------
+# Project created by QtCreator 2010-11-27T22:18:20
+# -------------------------------------------------
+TARGET = drawMapTest
+TEMPLATE = app
+SOURCES += main.cpp \
+    mainwindow.cpp \
+    drawmapscene.cpp
+HEADERS += mainwindow.h \
+    drawmapscene.h
+FORMS += mainwindow.ui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/drawMapTest/main.cpp	Sat Nov 27 23:57:31 2010 +0300
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/drawMapTest/mainwindow.cpp	Sat Nov 27 23:57:31 2010 +0300
@@ -0,0 +1,38 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "drawmapscene.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    DrawMapScene * scene = new DrawMapScene(this);
+    ui->graphicsView->setScene(scene);
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+    QMainWindow::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void MainWindow::resizeEvent(QResizeEvent * event)
+{
+    Q_UNUSED(event);
+
+    if(ui->graphicsView)
+        ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/drawMapTest/mainwindow.h	Sat Nov 27 23:57:31 2010 +0300
@@ -0,0 +1,25 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow {
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private:
+    Ui::MainWindow *ui;
+
+    virtual void resizeEvent(QResizeEvent * event);
+};
+
+#endif // MAINWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/drawMapTest/mainwindow.ui	Sat Nov 27 23:57:31 2010 +0300
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>600</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QGraphicsView" name="graphicsView"/>
+    </item>
+    <item>
+     <widget class="QPlainTextEdit" name="plainTextEdit">
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>80</height>
+       </size>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>