From a1d1448c19e4543f23242beb8e54b5a8d3467546 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 12 Nov 2012 09:18:47 +0000 Subject: [PATCH] 0021953: EDF GUI 2435 : The "desktop" section of the preference file may prevent the opening of the SALOME main window --- src/LightApp/LightApp_Application.cxx | 1 + src/Qtx/QtxMainWindow.cxx | 42 +++++++++++++++++++++------ src/Qtx/QtxMainWindow.h | 4 +++ 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 040503db1..cf0163b5a 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -254,6 +254,7 @@ LightApp_Application::LightApp_Application() STD_TabDesktop* desk = new STD_TabDesktop(); desk->setFullScreenAllowed(false); + desk->setMinimizeAllowed(false); setDesktop( desk ); diff --git a/src/Qtx/QtxMainWindow.cxx b/src/Qtx/QtxMainWindow.cxx index d8aa1e33f..574b8b0bb 100644 --- a/src/Qtx/QtxMainWindow.cxx +++ b/src/Qtx/QtxMainWindow.cxx @@ -242,7 +242,8 @@ QtxMainWindow::QtxMainWindow( QWidget* parent, Qt::WindowFlags f ) myOpaque( true ), myResizer( 0 ), myMouseMove( 0 ), - myFullScreenAllowed(true) + myFullScreenAllowed(true), + myMinimizeAllowed(true) { //rnv: Enables tooltips for inactive windows. //rnv: For details see http://bugtracker.opencascade.com/show_bug.cgi?id=20893 @@ -398,7 +399,7 @@ QString QtxMainWindow::storeGeometry() const state = QString( "max" ); break; case Qt::WindowMinimized: - state = QString( "min" ); + if ( isMinimizeAllowed() ) state = QString( "min" ); break; case Qt::WindowFullScreen: state = isFullScreenAllowed() ? QString( "full" ) : QString( "max" ); @@ -482,12 +483,16 @@ void QtxMainWindow::retrieveGeometry( const QString& str ) if ( stRx.indexIn( geom ) != -1 ) { QString stStr = stRx.cap( 1 ).trimmed().toLower(); - if ( stStr.startsWith( QString( "max" ) ) ) + if ( stStr.startsWith( QString( "max" ) ) ) { state = Qt::WindowMaximized; - else if ( stStr.startsWith( QString( "min" ) ) ) - state = Qt::WindowMinimized; - else if ( stStr.startsWith( QString( "full" ) ) ) - state = Qt::WindowFullScreen; + } + else if ( stStr.startsWith( QString( "min" ) ) ) { + if ( isMinimizeAllowed() ) + state = Qt::WindowMinimized; + } + else if ( stStr.startsWith( QString( "full" ) ) ) { + state = isFullScreenAllowed() ? Qt::WindowFullScreen : Qt::WindowMaximized; + } } resize( rect.size() ); @@ -629,7 +634,7 @@ bool QtxMainWindow::event( QEvent* e ) /*! \brief FullScreenAllowed flag allowed dump in the main window geometry Qt::WindowFullScreen parameter. - \return \c fullScreenAllowed flag. + \return \c FullScreenAllowed flag. */ bool QtxMainWindow::isFullScreenAllowed() const { return myFullScreenAllowed; @@ -639,8 +644,27 @@ bool QtxMainWindow::isFullScreenAllowed() const { /*! \brief Set FullScreenAllowed flag. The default value is true. - \param f value of the fullScreenAllowed flag. + \param f value of the FullScreenAllowed flag. */ void QtxMainWindow::setFullScreenAllowed( const bool f ) { myFullScreenAllowed = f; } + +/*! + \brief MinimizeAllowed flag allowed dump in the main window geometry + Qt::WindowMinimized parameter. + \return \c MinimizeAllowed flag. +*/ +bool QtxMainWindow::isMinimizeAllowed() const { + return myMinimizeAllowed; +} + + +/*! + \brief Set MinimizeAllowed flag. + The default value is true. + \param f value of the MinimizeAllowed flag. +*/ +void QtxMainWindow::setMinimizeAllowed( const bool f ) { + myMinimizeAllowed = f; +} diff --git a/src/Qtx/QtxMainWindow.h b/src/Qtx/QtxMainWindow.h index 5148f1d8e..8de97eb0b 100644 --- a/src/Qtx/QtxMainWindow.h +++ b/src/Qtx/QtxMainWindow.h @@ -57,6 +57,9 @@ public: bool isFullScreenAllowed() const; void setFullScreenAllowed( const bool ); + bool isMinimizeAllowed() const; + void setMinimizeAllowed( const bool ); + protected: virtual bool event( QEvent* ); @@ -71,6 +74,7 @@ private: QToolBar* myStatusBar; //!< dockable status bar bool myFullScreenAllowed; + bool myMinimizeAllowed; bool myOpaque; Resizer* myResizer; -- 2.39.2