]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Clear info panel when module is deactivated
authorvsr <vsr@opencascade.com>
Wed, 1 Jun 2022 10:10:53 +0000 (13:10 +0300)
committervsr <vsr@opencascade.com>
Wed, 1 Jun 2022 10:10:53 +0000 (13:10 +0300)
+ properly align actions not having icons in the Info panel

src/CAM/CAM_Application.cxx
src/CAM/CAM_Application.h
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/Qtx/QtxInfoPanel.cxx

index 46d47ef2b9c25222a3a8ee115a0fc18f90420287..aa92a3a9745d968826034dae0ec7dc0d170b19b6 100644 (file)
@@ -454,12 +454,14 @@ bool CAM_Application::activateModule( CAM_Module* mod )
   {
     if ( !myModule->deactivateModule( activeStudy() ) )
     {
-      // ....      
-    }    
+      // ???
+    }
+    moduleDeactivated( myModule );
   }     
   myModule = mod;
 
-  if ( myModule ){
+  if ( myModule )
+  {
     // Connect the module to the active study
     myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
     if ( !myModule->activateModule( activeStudy() ) )
@@ -607,6 +609,18 @@ void CAM_Application::moduleAdded( CAM_Module* /*mod*/ )
 {
 }
 
+/*!
+  \brief Callback function, called when the module is just deactivated.
+  
+  This virtual method can be re-implemented in the successors. Base implementation
+  does nothing.
+
+  \param mod module just deactivated
+*/
+void CAM_Application::moduleDeactivated( CAM_Module* /*mod*/ )
+{
+}
+
 /*!
   \brief Get module name by its title (user name).
   \param title module title (user name)
index 722e4387d30f3638ee32d1883bed576668d21483..3dc79da71e57e1171fd11ef7fdf0ba3775e3cf9e 100644 (file)
@@ -88,6 +88,7 @@ protected:
 
   virtual bool        checkModule( const QString& );
   virtual void        moduleAdded( CAM_Module* );
+  virtual void        moduleDeactivated( CAM_Module* );
   virtual void        beforeCloseDoc( SUIT_Study* );
   virtual void        afterCloseDoc();
   virtual bool        activateModule( CAM_Module* = 0 );
index e86a70914403dd37207f75b4073c550d65590aa7..9f042366bc8ed3c4545ac488251650448b5da7f8 100644 (file)
@@ -2330,6 +2330,12 @@ void LightApp_Application::moduleAdded( CAM_Module* mod )
   }
 }
 
+void LightApp_Application::moduleDeactivated( CAM_Module* /*mod*/ )
+{
+  if ( infoPanel() )
+    infoPanel()->clear();
+}
+
 void LightApp_Application::emptyPreferences( const QString& modName )
 {
   QtxPreferenceItem* item = myPrefs->findItem( modName, true );
index 8a6132ef74d697b109c39fecd73aa44a7a559c5d..c6e43cf47ee0b550a4e22fcb3acf66c3f7d70a22 100644 (file)
@@ -234,6 +234,7 @@ protected:
   virtual void                        beforeCloseDoc( SUIT_Study* );
   virtual void                        afterCloseDoc();
   virtual void                        moduleAdded( CAM_Module* );
+  virtual void                        moduleDeactivated( CAM_Module* );
   virtual bool                        activateModule( CAM_Module* = 0 );
 
   LightApp_Preferences*               preferences( const bool ) const;
index 5920d6fea967187503c4cb25c10c833c9ce9fef6..f2a36af99de0d87ee3ff9d20335ec8e8020d2952 100644 (file)
@@ -96,10 +96,30 @@ void QtxInfoPanel::Container::addLabel( const QString& text, Qt::Alignment align
 
 void QtxInfoPanel::Container::addAction( QAction* action, const int id )
 {
+  static const char* empty_xpm[] = {"16 16 1 1",
+                                    "  c None",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                ",
+                                    "                "};
   QToolButton* button = new QToolButton( this );
   button->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
   button->setAutoRaise( true );
+  if ( action->icon().isNull() )
+    action->setIcon( QPixmap(empty_xpm) );
   button->setDefaultAction( action );
   put( button );
   ids[ id ] = button;