Skip to content

Commit

Permalink
Re #4282. Fix the MantidMatrix dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jan 10, 2012
1 parent 0aad1f2 commit 960dd98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
18 changes: 13 additions & 5 deletions Code/Mantid/MantidPlot/src/MdiSubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ void MdiSubWindow::closeEvent( QCloseEvent *e )

switch(result)
{
case 0:
if (widget()->close())
case 0: // close
if (!widget() || widget()->close())
{
e->accept();
emit closedWindow(this);
Expand All @@ -178,12 +178,12 @@ void MdiSubWindow::closeEvent( QCloseEvent *e )
}
break;

case 1:
case 1: // hide
e->ignore();
emit hiddenWindow(this);
break;

case 2:
case 2: // cancel
e->ignore();
break;
}
Expand Down Expand Up @@ -475,6 +475,11 @@ d_app(appWindow)
setAttribute(Qt::WA_DeleteOnClose, false);
}

FloatingWindow::~FloatingWindow()
{
//std::cerr << "Deleted FloatingWindow\n";
}

/**
* Catch the WindowActivate event to tell ApplicationWindow that it's activated
*/
Expand Down Expand Up @@ -513,7 +518,10 @@ bool FloatingWindow::event(QEvent * e)
}
else if (e->type() == QEvent::Close)
{
d_app->removeFloatingWindow(this);
if (widget() && widget()->close())
{
d_app->removeFloatingWindow(this);
}
}
return QMainWindow::event(e);
}
Expand Down
11 changes: 9 additions & 2 deletions Code/Mantid/MantidPlot/src/MdiSubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ class MdiSubWindowParent_t: public QWidget
*
* These are the main objects of every Qtiplot project.
* All content (apart from the directory structure) is managed by subclasses of MdiSubWindow.
*
* With introduction of floating windows this class is no longer a sub-window (with window title and system menu)
* but rather the internal widget of a QMdiSubWindow or a FloatingWindow. The outer window can be changed between
* FloatingWindow and QMdiSubWindow at runtime using ApplicationWindow::changeToFloating(...) and
* ApplicationWindow::changeToDocked(...) methods. MdiSubWindow overrides show(), hide(), and close() methods so that the
* corresponding events are passed to the outer window.
*
* \section future Future Plans
* Rename to Aspect.
* MdiSubWindow can serve as a wrapper for another widget. Use MdiSubWindow::setWidget(...) to set its internal widget.
* In this case if close event needs to be processed override closeEvent(...) of the internal widget.
*
* \sa Folder, ApplicationWindow
*/
Expand Down Expand Up @@ -278,6 +284,7 @@ class FloatingWindow: public QMainWindow
Q_OBJECT
public:
FloatingWindow(ApplicationWindow* appWindow, Qt::WindowFlags f = 0);
~FloatingWindow();
void setStaysOnTopFlag();
void removeStaysOnTopFlag();
MdiSubWindow* mdiSubWindow() {return static_cast<MdiSubWindow*>(widget());}
Expand Down

0 comments on commit 960dd98

Please sign in to comment.