diff options
Diffstat (limited to 'old/tests/qtuitest/testapps/graphicsViewTest')
4 files changed, 96 insertions, 0 deletions
diff --git a/old/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro b/old/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro new file mode 100644 index 0000000..fa21ee2 --- /dev/null +++ b/old/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +unix:!maemo* { + # avoid the need for make install on *nix + DESTDIR=$$BUILDROOT/bin +} + +HEADERS += mainwindow.h +SOURCES += main.cpp mainwindow.cpp +mac:DESTDIR=$$BUILDROOT/bin + + +target.path += \ + /usr/local/bin + +INSTALLS += \ + target
\ No newline at end of file diff --git a/old/tests/qtuitest/testapps/graphicsViewTest/main.cpp b/old/tests/qtuitest/testapps/graphicsViewTest/main.cpp new file mode 100644 index 0000000..d5a6826 --- /dev/null +++ b/old/tests/qtuitest/testapps/graphicsViewTest/main.cpp @@ -0,0 +1,15 @@ + +#include <QtGui> + +#include "mainwindow.h" + +int main(int argv, char *args[]) +{ + QApplication gearsofwartactics(argv, args); + MainWindow mainWindow; + mainWindow.setGeometry(100, 100, 1024, 768); + mainWindow.show(); + + return gearsofwartactics.exec(); +} + diff --git a/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp b/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp new file mode 100644 index 0000000..45e3c88 --- /dev/null +++ b/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp @@ -0,0 +1,35 @@ +#include <QtGui> + + +#include "mainwindow.h" + +MainWindow::MainWindow() +{ + const QString pixmapString = "qtlogo4.png"; + item = new QGraphicsPixmapItem(pixmapString); + + textItem = new QGraphicsTextItem("here is some text"); + textItem->setTextInteractionFlags(Qt::TextEditable); + QGraphicsTextItem *textItem2 = new QGraphicsTextItem("and here is some more"); + textItem2->setTextInteractionFlags(Qt::TextEditable); + textItem2->setPos(20, 30); + scene = new QGraphicsScene(); +// scene->addItem(item); + scene->addItem(textItem); + scene->addItem(textItem2); + scene->setBackgroundBrush(Qt::lightGray); + + view = new QGraphicsView(scene); + view->rotate(-30); + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(view); + QLabel *label = new QLabel("hello world"); + layout->addWidget(label); + QWidget *widget = new QWidget; + widget->setLayout(layout); + + setCentralWidget(widget); + setWindowTitle(tr("Diagramscene")); + + +} diff --git a/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h b/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h new file mode 100644 index 0000000..c8b68aa --- /dev/null +++ b/old/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h @@ -0,0 +1,27 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +class QGraphicsView; +class QGraphicsScene; +class QGraphicsItem; +class QGraphicsTextItem; +class QGraphicsPixmapItem; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); +private: + + QGraphicsView *view; + QGraphicsScene *scene; + QGraphicsItem *item; + QGraphicsTextItem *textItem; + QGraphicsPixmapItem *gowtPixmapItem; +}; + +#endif |