]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
implementation "clear_in_neutral_point" for multi-selection control
authornds <nds@opencascade.com>
Fri, 29 Apr 2016 14:14:10 +0000 (17:14 +0300)
committernds <nds@opencascade.com>
Fri, 29 Apr 2016 14:15:05 +0000 (17:15 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h

index 180f0ee8b8fca8a8c4d68e1f740d2f8563f50a43..2e0c7e0ea0ce4b38b61fdb2dc5ad55dfa6567584 100755 (executable)
@@ -156,6 +156,8 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
 
   myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
   connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
+
+  myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
 }
 
 ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
@@ -379,6 +381,17 @@ void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
   myWorkshop->setSelected(anEmptyList);
 }
 
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::onSelectionChanged()
+{
+  if (!myIsNeutralPointClear) {
+    QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
+    if (aSelected.size() == 0)
+      return;
+  }
+  ModuleBase_WidgetSelector::onSelectionChanged();
+}
+
 void ModuleBase_WidgetMultiSelector::updateFocus()
 {
   // Set focus to List control in order to make possible 
index 1fbc337c90ed6f6b44695a55f40dde88fa4f87e8..56aa91a2395d1d529c77d6ff1ca58db7f9da0cbf 100755 (executable)
@@ -89,6 +89,10 @@ public slots:
   /// Slot is called on selection type changed
   void onSelectionTypeChanged();
 
+  /// Slot which is called on selection event. Redefined to process XML state about
+  /// clear selection in neutral point
+  virtual void onSelectionChanged();
+
 protected slots:
   /// Slot for copy command in a list pop-up menu
   void onCopyItem();
@@ -182,6 +186,9 @@ protected:
 
   /// A flag to store use_choice parameter state
   bool myIsUseChoice;
+
+  /// A flag to clear selection by click in empty place in the viewer
+  bool myIsNeutralPointClear;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */