Salome HOME
It removes SketchShapePlugin from plugins
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index af676208cc5d3c9c53c12096e93c092d6ab06812..95dfd185fde18a941bfab9e8e5a3c1cc04ddb9e4 100755 (executable)
@@ -32,6 +32,7 @@
 #include <QAction>
 #include <QApplication>
 #include <QClipboard>
+#include <QTimer>
 
 #include <memory>
 #include <string>
@@ -60,10 +61,21 @@ public:
   /// Redefinition of virtual method
   virtual QSize        minimumSizeHint() const
   {
-    int aHeight = 2*QFontMetrics( font() ).height();
+    int aHeight = 4/*2*/*QFontMetrics( font() ).height();
     QSize aSize = QListWidget::minimumSizeHint();
     return QSize( aSize.width(), aHeight );
   }
+
+#ifndef WIN32
+// The code is necessary only for Linux because
+//it can not update viewport on widget resize
+protected:
+  void resizeEvent(QResizeEvent* theEvent)
+  {
+    QListWidget::resizeEvent(theEvent);
+    QTimer::singleShot(5, viewport(), SLOT(repaint()));
+  }
+#endif
 };
 
 ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent,
@@ -304,8 +316,7 @@ QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
 //********************************************************************
 void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
 {
-  activateSelection(true);
-  activateFilters(true);
+  activateSelectionAndFilters(true);
   QList<ModuleBase_ViewerPrs> anEmptyList;
   // This method will call Selection changed event which will call onSelectionChanged
   // To clear mySelection, myListControl and storeValue()
@@ -318,7 +329,8 @@ void ModuleBase_WidgetMultiSelector::updateFocus()
   // Set focus to List control in order to make possible 
   // to use Tab key for transfer the focus to next widgets
   myListControl->setCurrentRow(myListControl->model()->rowCount() - 1);
-  myListControl->setFocus();
+  ModuleBase_Tools::setFocus(myListControl,
+                             "ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()");
 }
 
 //********************************************************************
@@ -354,14 +366,12 @@ void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const TopAbs_ShapeEnum
     aShapeTypeName = myTypeCombo->itemText(idx);
     TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
     if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
-      activateSelection(false);
-      activateFilters(false);
+      activateSelectionAndFilters(false);
       bool isBlocked = myTypeCombo->blockSignals(true);
       myTypeCombo->setCurrentIndex(idx);
       myTypeCombo->blockSignals(isBlocked);
 
-      activateSelection(true);
-      activateFilters(true);
+      activateSelectionAndFilters(true);
       break;
     }
   }