Isis 3 Programmer Reference
MatrixGraphicsView.cpp
1 #include "MatrixGraphicsView.h"
2 
3 #include <iostream>
4 
5 #include <QResizeEvent>
6 #include <QScrollBar>
7 
8 namespace Isis {
9  MatrixGraphicsView::MatrixGraphicsView(QGraphicsScene *scene,
10  QWidget *parent) : QGraphicsView(scene, parent) {
11  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
12  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
13 
14  p_resizeZooming = true;
15 
16 // setRenderHint(QPainter::SmoothPixmapTransform,false);
17 // setRenderHint(QPainter::HighQualityAntialiasing,false);
18 // setRenderHint(QPainter::NonCosmeticDefaultPen,true);
19 // setOptimizationFlag(QGraphicsView::DontSavePainterState);
20  setCacheMode(QGraphicsView::CacheBackground);
21  }
22 
23  MatrixGraphicsView::~MatrixGraphicsView() {
24  }
25 
26 
27  void MatrixGraphicsView::contextMenuEvent(QContextMenuEvent *event) {
28  QGraphicsView::contextMenuEvent(event);
29  }
30 
31 
32  void MatrixGraphicsView::resizeEvent(QResizeEvent *event) {
33  if(event->oldSize().isEmpty() || p_resizeZooming) {
34  QRectF sceneRect(scene()->itemsBoundingRect());
35  fitInView(sceneRect, Qt::KeepAspectRatio);
36  }
37 
38  QGraphicsView::resizeEvent(event);
39  }
40 }
41 
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31