7 #include <QGraphicsRectItem> 8 #include "ViewProfile.h" 9 #include "ViewProfileParameters.h" 11 const int FRAME_WIDTH = 2;
15 const double SLOP_ON_SIDES = 0.5;
20 QGraphicsView (scene, parent)
22 setRenderHint (QPainter::Antialiasing);
23 setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
24 setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
26 setMinimumHeight (160);
27 setMaximumHeight (160);
28 setMinimumWidth (minimumWidth);
34 void ViewProfile::createFrame ()
36 m_frame =
new QGraphicsRectItem (0, 0, 100, 100);
37 m_frame->setPen (QPen (QBrush (qRgb (0.0, 0.0, 0.0)), FRAME_WIDTH));
39 scene()->addItem (m_frame);
42 void ViewProfile::refit ()
45 QRectF bounds = QRectF (VIEW_PROFILE_X_MIN - SLOP_ON_SIDES,
47 VIEW_PROFILE_X_MAX + 2 * SLOP_ON_SIDES,
50 setSceneRect (bounds);
57 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.