Isis 3 Programmer Reference
MosaicGraphicsView.cpp
1 #include "MosaicGraphicsView.h"
2 
3 #include <iostream>
4 
5 #include <QResizeEvent>
6 #include <QScrollBar>
7 
8 namespace Isis {
9  MosaicGraphicsView::MosaicGraphicsView(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 // setRenderHint(QPainter::Qt4CompatiblePainting, true);
21  setCacheMode(QGraphicsView::CacheBackground);
22  }
23 
24  MosaicGraphicsView::~MosaicGraphicsView() {
25  }
26 
27 
28  void MosaicGraphicsView::contextMenuEvent(QContextMenuEvent *event) {
29  QGraphicsView::contextMenuEvent(event);
30  }
31 
32 
33  void MosaicGraphicsView::resizeEvent(QResizeEvent *event) {
34  if(m_oldSize.isEmpty() || p_resizeZooming) {
35  QRectF sceneRect(scene()->itemsBoundingRect());
36  fitInView(sceneRect, Qt::KeepAspectRatio);
37  m_oldSize = event->size();
38  }
39 
40  QGraphicsView::resizeEvent(event);
41  }
42 }
43 
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31