Codes reviewed by wallika
authorJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Thu, 15 Apr 2010 09:37:35 +0000 (12:37 +0300)
committerJukka Saastamoinen <juksa@czc6303cj1.ixonos.local>
Thu, 15 Apr 2010 09:37:35 +0000 (12:37 +0300)
src/ui/listviewscreen.cpp
src/ui/pixmap.h

index 2500fe1..2e02e2c 100644 (file)
@@ -29,7 +29,7 @@
 #include "listviewscreen.h"
 #include "pixmap.h"
 #include "infotab.h"
-
+#include <QDebug>
 
 ListViewScreen::ListViewScreen(QWidget *parent)
    : QWidget(parent)
@@ -46,17 +46,21 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     QGraphicsProxyWidget *widgetProxy = new QGraphicsProxyWidget();
     widgetProxy->setWidget(personalInfo);
 
-    QGraphicsScene *scene= new QGraphicsScene(0,0,700,360);
+    QGraphicsScene *scene= new QGraphicsScene();
     QGraphicsWidget *graphWidget = new QGraphicsWidget();
     graphLayout = new QGraphicsLinearLayout(graphWidget);
     graphLayout->setOrientation(Qt::Horizontal);
     graphLayout->addItem(widgetProxy);
     scene->setBackgroundBrush(Qt::white);    
-    //scene->addItem(widgetProxy);
     scene->addItem(graphWidget);
     scene->addItem(arrowbutton);
+    qDebug() << "Scene width: " << scene->width();
+    qDebug() << "Scene heigth: " << scene->height();
 
     QGraphicsView *view = new QGraphicsView(scene);
+    view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
+    view->setSceneRect(0,0,7000,3000);
+    view->centerOn(QPointF(0,0));
     view->setFrameStyle(0);
     view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
     view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -70,12 +74,12 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     machine->setInitialState(state1);
 
     // State 1
-    state1->assignProperty(graphWidget,"pos",QPointF(-(personalInfo->width()+20),(scene->height()/4)));
-    state1->assignProperty(arrowbutton,"pos",QPointF(0,(scene->height()/2 - (arrowbutton->boundingRect().height()/2))));
+    state1->assignProperty(graphWidget,"pos",QPointF(-(personalInfo->width()+20),0));
+    state1->assignProperty(arrowbutton,"pos",QPointF(0,(arrowbutton->boundingRect().height()/2)+10));
 
     // State 2
-    state2->assignProperty(graphWidget,"pos",QPointF(-15,(scene->height()/4)));
-    state2->assignProperty(arrowbutton,"pos",QPointF(0,(scene->height()/2 - (arrowbutton->boundingRect().height()/2))));
+    state2->assignProperty(graphWidget,"pos",QPointF(-20,0));
+    state2->assignProperty(arrowbutton,"pos",QPointF((personalInfo->width()-5),(arrowbutton->boundingRect().height()/2)+10));
 
     QAbstractTransition *trans1 = state1->addTransition(arrowbutton,SIGNAL(clicked()),state2);
     trans1->addAnimation(new QPropertyAnimation(graphWidget,"pos"));
index 9a6b47e..40e2c63 100644 (file)
@@ -51,6 +51,13 @@ public:
     */
     void mousePressEvent(QGraphicsSceneMouseEvent *event);
     /**
+    * @brief Bounding box of the drawed pixmap
+    *
+    * @return Rectangle shaped bounding box of the pixmap
+    */
+    QRectF boundingRect() const;
+protected:
+    /**
     * @brief Drawer of the given picture
     *
     * @param painter Pointer to painting class
@@ -58,12 +65,6 @@ public:
     * @param Pointer to the widget
     */
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
-    /**
-    * @brief Bounding box of the drawed pixmap
-    *
-    * @return Rectangle shaped bounding box of the pixmap
-    */
-    QRectF boundingRect() const;
 signals:
     /**
     * @brief Signal which is emitted when the pixmap