Isis 3 Programmer Reference
ViewportMdiSubWindow.cpp
1 #include "ViewportMdiSubWindow.h"
2 
3 #include <QCloseEvent>
4 #include <QDebug>
5 #include <QProgressBar>
6 #include <QVBoxLayout>
7 #include <QWidget>
8 
9 #include "CubeViewport.h"
10 #include "MdiCubeViewport.h"
11 
12 namespace Isis {
14  : QMdiSubWindow(parent) {
15  m_viewport = NULL;
16 
17  setWidget(new QWidget());
18 
19  widget()->setLayout(new QVBoxLayout());
20 
21  m_viewport = new MdiCubeViewport(cubeToView, NULL, widget());
22  widget()->layout()->addWidget(m_viewport);
23 
24  QProgressBar *progressBar = new QProgressBar;
25  progressBar->setRange(0, 100);
26  progressBar->setValue(0);
27 
28  connect(m_viewport, SIGNAL(progressChanged(int)),
29  progressBar, SLOT(setValue(int)));
30  connect(m_viewport, SIGNAL(progressComplete()), progressBar, SLOT(hide()));
31  connect(this, SIGNAL(closeViewport(CubeViewport *)),
32  m_viewport, SIGNAL(viewportClosed(CubeViewport *)));
33  widget()->layout()->addWidget(progressBar);
34 
35  setOption(QMdiSubWindow::RubberBandResize, true);
36  setOption(QMdiSubWindow::RubberBandMove, true);
37  }
38 
39 
41  m_viewport = NULL;
42  }
43 
44 
46  return m_viewport;
47  }
48 
49 
50  void ViewportMdiSubWindow::closeEvent(QCloseEvent *e) {
51  if (!m_viewport->confirmClose()) {
52  e->ignore();
53  }
54  else {
55  e->accept();
56  QMdiSubWindow::closeEvent(e);
58  }
59  }
60 }
Cube display widget for certain Isis MDI applications.
ViewportMdiSubWindow(Cube *cubeToView, QWidget *parent=NULL)
Constrctor for the ViewportMdiSubWindow.
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:132
~ViewportMdiSubWindow()
Deconstructor for ViewportMdiSubWindow.
void closeViewport(CubeViewport *vp)
This method closes the viewport.
MdiCubeViewport * viewport()
Grabs the viewport.
virtual void closeEvent(QCloseEvent *e)
This method is called as the closeEvent.
QPointer< MdiCubeViewport > m_viewport
Pointer to the MdiCubeViewports.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
IO Handler for Isis Cubes.
Definition: Cube.h:170