Isis 3.0 Programmer Reference
Back | Home
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 {
13  ViewportMdiSubWindow::ViewportMdiSubWindow(Cube *cubeToView, QWidget *parent)
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(this, SIGNAL(closeViewport(CubeViewport *)),
31  m_viewport, SIGNAL(viewportClosed(CubeViewport *)));
32  widget()->layout()->addWidget(progressBar);
33 
34  setOption(QMdiSubWindow::RubberBandResize, true);
35  setOption(QMdiSubWindow::RubberBandMove, true);
36  }
37 
38 
39  ViewportMdiSubWindow::~ViewportMdiSubWindow() {
40  m_viewport = NULL;
41  }
42 
43 
44  MdiCubeViewport *ViewportMdiSubWindow::viewport() {
45  return m_viewport;
46  }
47 
48 
49  void ViewportMdiSubWindow::closeEvent(QCloseEvent *e) {
50  if (!m_viewport->confirmClose()) {
51  e->ignore();
52  }
53  else {
54  e->accept();
55  QMdiSubWindow::closeEvent(e);
56  emit closeViewport(m_viewport);
57  }
58  }
59 }

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:31:31