1 /***************************************************************************
2 geomeytrval.cpp - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
19 #include "geometryval.h"
20 #include <QGraphicsView>
21 #include <QVBoxLayout>
22 #include <QGraphicsScene>
23 #include "graphicsscenerectmove.h"
24 #include <QGraphicsRectItem>
25 #include <QMouseEvent>
28 Geometryval::Geometryval(QWidget* parent): QWidget(parent) {
30 QVBoxLayout* vbox = new QVBoxLayout(this);
31 ui.widget->setLayout(vbox);
32 QGraphicsView *view = new QGraphicsView(this);
33 view->setBackgroundBrush(QBrush(QColor(0, 0, 0)));
34 vbox->addWidget(view);
36 ui.frame->setTickPosition(QSlider::TicksBelow);
38 scene = new GraphicsSceneRectMove(this);
39 scene->setTool(TITLE_SELECT);
40 view->setScene(scene);
41 double aspect = 4.0 / 3.0; //change to project val
42 QGraphicsRectItem *m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, 100.0*aspect, 100));
43 m_frameBorder->setZValue(-1100);
44 //m_frameBorder->setBrush(QColor(255, 255, 0, 255));
45 m_frameBorder->setPen(QPen(QBrush(QColor(255, 255, 255, 255)), 1.0, Qt::DashLine));
46 scene->addItem(m_frameBorder);
48 paramRect = new QGraphicsRectItem(QRectF(20.0*aspect, 20, 80*aspect, 80));
50 paramRect->setZValue(0);
51 //m_frameBorder1->setBrush(QColor(255, 0, 0, 0));
52 paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0));
54 scene->addItem(paramRect);
56 scene->setSceneRect(-100.0*aspect, -100, 300.0*aspect, 300);
59 void Geometryval::mouseMoveEvent(QMouseEvent *event) {
60 //if (event->button())
61 kDebug() << paramRect->rect();
64 QDomElement Geometryval::getParamDesc() {
68 void Geometryval::setupParam(const QDomElement& par, const QString& paramName, int minFrame, int maxFrame) {
70 ui.frame->setRange(minFrame, maxFrame);