Isis 3 Programmer Reference
MatrixGraphicsScene.cpp
1 #include "MatrixGraphicsScene.h"
2 
3 #include <QGraphicsSceneMouseEvent>
4 
5 #include "MatrixSceneWidget.h"
6 
7 namespace Isis {
8  MatrixGraphicsScene::MatrixGraphicsScene(MatrixSceneWidget *parent) : QGraphicsScene(parent) {
9  }
10 
11  MatrixGraphicsScene::~MatrixGraphicsScene() {
12  }
13 
14 
15  void MatrixGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) {
16  if ( selectedItems().count() < 2 ||
17  !qobject_cast<MatrixSceneWidget *>( parent() )->contextMenuEvent(contextMenuEvent) ) {
18  QGraphicsScene::contextMenuEvent(contextMenuEvent);
19  }
20  }
21 
22 
23  void MatrixGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) {
24  if (mouseEvent->button() == Qt::RightButton) {
25  // Do nothing on right click... this prevents the loss of selection before a context event
26  mouseEvent->accept();
27  }
28  else {
29  QGraphicsScene::mousePressEvent(mouseEvent);
30  emit selectionChanged();
31  }
32  }
33 }
34 
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31