Salome HOME
Enable simultaneous usage of several StdMeshersGUI_SubShapeSelectorWdg's
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.cxx
index 54560d8fc9bf96b6a7bc3b9ec70dda0a99dbeff7..31db0a7be7f4e5add339605081fde9fe0cf9eb0a 100644 (file)
@@ -74,7 +74,8 @@ StdMeshersGUI_SubShapeSelectorWdg
 ::StdMeshersGUI_SubShapeSelectorWdg( QWidget *        parent,
                                      TopAbs_ShapeEnum subShType,
                                      const bool       toShowList,
 ::StdMeshersGUI_SubShapeSelectorWdg( QWidget *        parent,
                                      TopAbs_ShapeEnum subShType,
                                      const bool       toShowList,
-                                     const bool       toShowActivateBtn ):
+                                     const bool       toShowActivateBtn,
+                                     const int        minListWidth ):
   QWidget( parent ),
   myMaxSize( -1 ),
   myPreviewActor( 0 )
   QWidget( parent ),
   myMaxSize( -1 ),
   myPreviewActor( 0 )
@@ -93,8 +94,8 @@ StdMeshersGUI_SubShapeSelectorWdg
     myAddButton      = new QPushButton( tr( "SMESH_BUT_ADD" ),    this );
     myRemoveButton   = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
     myListWidget->setSelectionMode( QListWidget::ExtendedSelection );
     myAddButton      = new QPushButton( tr( "SMESH_BUT_ADD" ),    this );
     myRemoveButton   = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );
     myListWidget->setSelectionMode( QListWidget::ExtendedSelection );
-    myListWidget->setMinimumWidth(300);
-    myListWidget->setWrapping(true);
+    myListWidget->setMinimumWidth( minListWidth );
+    myListWidget->setWrapping( true );
     myActivateButton->setCheckable( true );
   }
   else
     myActivateButton->setCheckable( true );
   }
   else
@@ -254,6 +255,20 @@ void StdMeshersGUI_SubShapeSelectorWdg::ShowPreview( bool visible)
   }
 }
 
   }
 }
 
+//================================================================================
+/*!
+ * \brief Connect selection slots
+  * \param other - another StdMeshersGUI_ObjectReferenceParamWdg
+ */
+//================================================================================
+
+void StdMeshersGUI_SubShapeSelectorWdg::
+AvoidSimultaneousSelection ( StdMeshersGUI_SubShapeSelectorWdg* other)
+{
+  connect(other, SIGNAL(selectionActivated()), this, SLOT(deactivateSelection()));
+  connect(this, SIGNAL(selectionActivated()), other, SLOT(deactivateSelection()));
+}
+
 //================================================================================
 /*!
  * \brief Connect/disconnect to change of selection
 //================================================================================
 /*!
  * \brief Connect/disconnect to change of selection
@@ -275,7 +290,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate )
 
   if ( toActivate )
   {
 
   if ( toActivate )
   {
-    connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(selectionIntoArgument()));
+    connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(selectionIntoArgument()));
   }
   else
   {
   }
   else
   {
@@ -284,6 +299,9 @@ void StdMeshersGUI_SubShapeSelectorWdg::ActivateSelection( bool toActivate )
 
   if ( sender() == myActivateButton )
     ShowPreview( toActivate );
 
   if ( sender() == myActivateButton )
     ShowPreview( toActivate );
+
+  if ( toActivate )
+    emit selectionActivated();
 }
 
 //================================================================================
 }
 
 //================================================================================