1 #include <QGraphicsRectItem>
2 #include "ViewProfile.h"
3 #include "ViewProfileParameters.h"
5 const int FRAME_WIDTH = 2;
9 const double SLOP_ON_SIDES = 0.5;
14 QGraphicsView (scene, parent)
16 setRenderHint (QPainter::Antialiasing);
17 setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
18 setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
20 setMinimumHeight (160);
21 setMaximumHeight (160);
22 setMinimumWidth (minimumWidth);
28 void ViewProfile::createFrame ()
30 m_frame =
new QGraphicsRectItem (0, 0, 100, 100);
31 m_frame->setPen (QPen (QBrush (qRgb (0.0, 0.0, 0.0)), FRAME_WIDTH));
33 scene()->addItem (m_frame);
36 void ViewProfile::refit ()
39 QRectF bounds = QRectF (VIEW_PROFILE_X_MIN - SLOP_ON_SIDES,
41 VIEW_PROFILE_X_MAX + 2 * SLOP_ON_SIDES,
44 setSceneRect (bounds);
51 QGraphicsView::resizeEvent (event);
virtual void resizeEvent(QResizeEvent *event)
Intercept resize events so the geometry can be scaled to perfectly fit into the window.
ViewProfile(QGraphicsScene *scene, int minimumWidth, QWidget *parent=0)
Single constructor.