Salome HOME
Parent object parameter added to constructor.
[modules/gui.git] / src / SUIT / SUIT_ExceptionHandler.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #include "SUIT_ExceptionHandler.h"
20
21 #include "SUIT_MessageBox.h"
22
23 #include <qapplication.h>
24
25 /*!\class SUIT_ExceptionHandler
26  * Show exception message on error handler.
27  */
28
29 /*!
30   Checks: is internal handle on object \a o?
31 */
32 bool SUIT_ExceptionHandler::handle( QObject* o, QEvent* e )
33 {
34   return internalHandle( o, e );
35 }
36
37 /*!
38   Checks: is internal handle on object \a o?
39 */
40 bool SUIT_ExceptionHandler::internalHandle( QObject* o, QEvent* e )
41 {
42   return qApp ? qApp->QApplication::notify( o, e ) : false;
43 }
44
45 /*!
46   Show error message \a mgs, if application is not null.
47 */
48 void SUIT_ExceptionHandler::showMessage( const QString& title, const QString& msg )
49 {
50   if ( !qApp )
51     return;
52
53   SUIT_MessageBox::error1( qApp->mainWidget(), title, msg, "OK" );
54 }