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
12namespace 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
43
44
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}
IO Handler for Isis Cubes.
Definition Cube.h:168
Widget to display Isis cubes for qt apps.
Cube display widget for certain Isis MDI applications.
MdiCubeViewport * viewport()
Grabs the viewport.
virtual void closeEvent(QCloseEvent *e)
This method is called as the closeEvent.
~ViewportMdiSubWindow()
Deconstructor for ViewportMdiSubWindow.
QPointer< MdiCubeViewport > m_viewport
Pointer to the MdiCubeViewports.
ViewportMdiSubWindow(Cube *cubeToView, QWidget *parent=NULL)
Constrctor for the ViewportMdiSubWindow.
void closeViewport(CubeViewport *vp)
This method closes the viewport.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16