Manage close event (unchecks the menu item in main window)

This commit is contained in:
Tats
2014-03-15 23:55:29 -04:00
parent 392869f56f
commit b313edc553
3 changed files with 18 additions and 1 deletions

View File

@@ -677,6 +677,7 @@ void MainWindow::createLayout()
// Output changed -> change destinatioin
connect(outputWindow->getCanvas(), SIGNAL(shapeChanged(Shape*)),
destinationCanvas, SLOT(updateCanvas()));
// connect(destinationCanvas, SIGNAL(imageChanged()),
// sourceCanvas, SLOT(updateCanvas()));
@@ -830,8 +831,13 @@ void MainWindow::createActions()
displayOutputWindow->setStatusTip(tr("Display output window"));
displayOutputWindow->setCheckable(true);
displayOutputWindow->setChecked(true);
// Manage show/hide of GL output window.
connect(displayOutputWindow, SIGNAL(toggled(bool)), this, SLOT(toggleOutputWindow(bool)));
// When closing the GL output window, uncheck the action in menu.
connect(outputWindow, SIGNAL(closed()), displayOutputWindow, SLOT(toggle()));
}
void MainWindow::createMenus()

View File

@@ -35,6 +35,12 @@ OutputGLWindow::OutputGLWindow(QWidget* parent, const QGLWidget * shareWidget) :
setLayout(layout);
}
void OutputGLWindow::closeEvent(QCloseEvent *event)
{
emit closed();
event->accept();
}
//void OutputGLWindow::updateCanvas() {
// qDebug() << "Update output canvas" << endl;
// canvas->updateCanvas();

View File

@@ -28,11 +28,16 @@
//since we dont want this window to be closed by the user
class OutputGLWindow : public QDialog
{
Q_OBJECT
public:
OutputGLWindow(QWidget* parent = 0, const QGLWidget * shareWidget = 0);
protected:
void closeEvent(QCloseEvent *){}
void closeEvent(QCloseEvent* event);
signals:
void closed();
public:
DestinationGLCanvas* getCanvas() const { return canvas; }