]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create filtering launch widget
authorvsv <vsv@opencascade.com>
Thu, 8 Nov 2018 15:08:04 +0000 (18:08 +0300)
committervsv <vsv@opencascade.com>
Thu, 8 Nov 2018 15:08:04 +0000 (18:08 +0300)
src/CollectionPlugin/group_widget.xml
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_ChoiceCtrl.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetSelectionFilter.h [new file with mode: 0644]
src/PartSet/PartSet_WidgetSketchCreator.cpp
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/filter.png [new file with mode: 0644]
src/XGUI/pictures/plus_minus.png [new file with mode: 0644]

index 4696d9e790ce3ce22d81dcecab882b42034414e5..7f1f874cd3924a1b3b9b7a97ac078322c1ba7a70 100644 (file)
@@ -28,6 +28,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     tooltip="Select a set of objects"
     type_choice="Vertices Edges Faces Solids"
     use_choice="true"
+    use_filters="true"
     clear_in_neutral_point="false"
     filter_points="false" >
     <validator id="GeomValidators_BodyShapes"/>
index ee79fe18606b89c6063ec90cd8f5c6b678aee875..be394b0947d7dadad10f5a3c3a6ddb66f7c27e92 100644 (file)
@@ -104,6 +104,7 @@ SET(PROJECT_HEADERS
   ModuleBase_WidgetRadiobox.h
   ModuleBase_WidgetPointInput.h
   ModuleBase_ITreeNode.h
+  ModuleBase_WidgetSelectionFilter.h
 )
 
 SET(PROJECT_MOC_HEADERS
@@ -153,6 +154,7 @@ SET(PROJECT_MOC_HEADERS
   ModuleBase_WidgetNameEdit.h
   ModuleBase_WidgetRadiobox.h
   ModuleBase_WidgetPointInput.h
+  ModuleBase_WidgetSelectionFilter.h
 )
 
 SET(PROJECT_SOURCES
@@ -221,6 +223,7 @@ SET(PROJECT_SOURCES
   ModuleBase_WidgetNameEdit.cpp
   ModuleBase_WidgetRadiobox.cpp
   ModuleBase_WidgetPointInput.cpp
+  ModuleBase_WidgetSelectionFilter.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 67b5b6f186eb55d9b6b085ba783c921a4b63a74e..2f35c0e0a2feeaa4b159d5ba353f044544875c4c 100644 (file)
@@ -38,7 +38,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget* theParent,
  : QWidget(theParent), myType(theType)
 {
   QHBoxLayout* aLayout = new QHBoxLayout(this);
-  ModuleBase_Tools::adjustMargins(aLayout);
+  aLayout->setContentsMargins(0, 0, 0, 0);
 
   switch (myType) {
   case RadioButtons:
index d81556ac18bbdd20b80d2ec258f5de0cf3632ecc..548342f58c348d0769662c59a804985b9844e476 100755 (executable)
@@ -38,6 +38,7 @@
 #include <ModuleBase_ViewerPrs.h>
 #include <ModuleBase_WidgetShapeSelector.h>
 #include <ModuleBase_ChoiceCtrl.h>
+#include <ModuleBase_WidgetSelectionFilter.h>
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
@@ -119,14 +120,14 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
   myIsUseChoice = theData->getBooleanAttribute("use_choice", false);
 
-  QGridLayout* aMainLay = new QGridLayout(this);
+  QVBoxLayout* aMainLay = new QVBoxLayout(this);
   ModuleBase_Tools::adjustMargins(aMainLay);
 
   QStringList aIconsList = getIconsList(myShapeTypes);
   myTypeCtrl = new ModuleBase_ChoiceCtrl(this, myShapeTypes, aIconsList);
   myTypeCtrl->setLabel(tr("Type"));
   myTypeCtrl->setValue(0);
-  aMainLay->addWidget(myTypeCtrl, 0, 0, 1, 2);
+  aMainLay->addWidget(myTypeCtrl);
   myDefMode = myShapeTypes.first().toStdString();
 
   // There is no sense to parameterize list of types while we can not parameterize selection mode
@@ -136,18 +137,30 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   }
 
   QString aLabelText = translate(theData->getProperty("label"));
-  QLabel* aListLabel = new QLabel(aLabelText, this);
-  aMainLay->addWidget(aListLabel, 1, 0);
-  // if the xml definition contains one type, an information label
-  // should be shown near to the latest
-  if (myShapeTypes.size() <= 1) {
-    QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
-    if (!aLabelIcon.isEmpty()) {
-      QLabel* aSelectedLabel = new QLabel("", this);
-      aSelectedLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon));
-      aMainLay->addWidget(aSelectedLabel, 1, 1);
+  if (aLabelText.size() > 0) {
+    QWidget* aLabelWgt = new QWidget(this);
+    QHBoxLayout* aLabelLayout = new QHBoxLayout(aLabelWgt);
+    aLabelLayout->setContentsMargins(0, 0, 0, 0);
+    aMainLay->addWidget(aLabelWgt);
+
+    QLabel* aListLabel = new QLabel(aLabelText, this);
+    aLabelLayout->addWidget(aListLabel);
+    // if the xml definition contains one type, an information label
+    // should be shown near to the latest
+    if (myShapeTypes.size() <= 1) {
+      QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
+      if (!aLabelIcon.isEmpty()) {
+        QLabel* aSelectedLabel = new QLabel("", this);
+        aSelectedLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon));
+        aLabelLayout->addWidget(aSelectedLabel);
+        aLabelLayout->addStretch(1);
+      }
     }
-    aMainLay->setColumnStretch(2, 1);
+  }
+  bool aUseFilters = theData->getBooleanAttribute("use_filters", false);
+  if (aUseFilters) {
+    myFiltersWgt = new ModuleBase_FilterStarter(this, theWorkshop);
+    aMainLay->addWidget(myFiltersWgt);
   }
 
   QString aToolTip = QString::fromStdString(theData->widgetTooltip());
@@ -157,11 +170,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
   connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem()));
   connect(myListView, SIGNAL(listActivated()), SLOT(onListActivated()));
 
-  aMainLay->addWidget(myListView->getControl(), 2, 0, 1, -1);
-  aMainLay->setRowStretch(2, 1);
-  //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
-  //aMainLay->setRowMinimumHeight(3, 20);
-  //this->setLayout(aMainLay);
+  aMainLay->addWidget(myListView->getControl());
   connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
 
   myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
index 1a40c13039cbd13a795a93da7441f84a470dd3db..ec6612c1be17613a2573e5b997f1bf7f2fcb4633 100755 (executable)
@@ -41,6 +41,7 @@ class QWidget;
 class ModuleBase_ListView;
 class ModuleBase_IWorkshop;
 class ModuleBase_ChoiceCtrl;
+class ModuleBase_FilterStarter;
 
 /**
 * \ingroup GUI
@@ -247,6 +248,8 @@ protected:
 
   bool myIsFirst;
   std::string myDefMode;
+
+  ModuleBase_FilterStarter* myFiltersWgt;
 };
 
 #endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp
new file mode 100644 (file)
index 0000000..3120487
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ModuleBase_WidgetSelectionFilter.h"
+#include "ModuleBase_Tools.h"
+#include "ModuleBase_IWorkshop.h"
+
+#include <QLayout>
+#include <QPushButton>
+#include <QLabel>
+#include <QPicture>
+
+ModuleBase_FilterStarter::ModuleBase_FilterStarter(QWidget* theParent,
+  ModuleBase_IWorkshop* theWorkshop)
+  : QWidget(theParent),
+  myWorkshop(theWorkshop)
+{
+  QHBoxLayout* aMainLayout = new QHBoxLayout(this);
+  ModuleBase_Tools::adjustMargins(aMainLayout);
+
+  aMainLayout->addStretch(1);
+  QPushButton* aLaunchBtn = new QPushButton(tr("Selection by filters"), this);
+  connect(aLaunchBtn, SIGNAL(clicked()), SLOT(onFiltersLaunch()));
+  aMainLayout->addWidget(aLaunchBtn);
+
+  myFilterLbl = new QLabel(this);
+  myFilterLbl->setPixmap(QPixmap(":pictures/filter.png"));
+  aMainLayout->addWidget(myFilterLbl);
+
+  myModifyLbl = new QLabel(this);
+  myModifyLbl->setPixmap(QPixmap(":pictures/plus_minus.png"));
+  aMainLayout->addWidget(myModifyLbl);
+  aMainLayout->addStretch(1);
+
+  myFilterLbl->hide();
+  myModifyLbl->hide();
+}
+
+void ModuleBase_FilterStarter::onFiltersLaunch()
+{
+
+}
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h
new file mode 100644 (file)
index 0000000..24a01ee
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef ModuleBase_WidgetSelectionFilter_H
+#define ModuleBase_WidgetSelectionFilter_H
+
+#include <ModuleBase.h>
+#include <QWidget>
+
+class QLabel;
+class ModuleBase_IWorkshop;
+
+class MODULEBASE_EXPORT ModuleBase_FilterStarter: public QWidget
+{
+  Q_OBJECT
+public:
+  ModuleBase_FilterStarter(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop);
+
+  ~ModuleBase_FilterStarter() {}
+
+private slots:
+  void onFiltersLaunch();
+
+private:
+  QLabel* myFilterLbl;
+  QLabel* myModifyLbl;
+
+  ModuleBase_IWorkshop* myWorkshop;
+};
+
+
+#endif
\ No newline at end of file
index 7f9fc5adae6c9a4a3725f0d91e36e1138b66b86a..9768badfd8319e30ae35842f02c9ee9a8452b11c 100644 (file)
@@ -383,10 +383,6 @@ bool PartSet_WidgetSketchCreator::startSketchOperation(
   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
 
-  // Launch Sketch operation
-  CompositeFeaturePtr aCompFeature =
-    std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
-
   // start edit operation for the sketch
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                             (myModule->createOperation("Sketch"));
index ea9614f94e2b2d4bee5d4c0483a7c3b01981548b..ace18607c4444501ea17be3c8c865b127fa0f347 100644 (file)
@@ -77,5 +77,8 @@
      <file>pictures/autoapply_start.png</file>
      <file>pictures/autoapply_stop.png</file>
      <file>pictures/whatis.png</file>
+
+     <file>pictures/filter.png</file>
+     <file>pictures/plus_minus.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/filter.png b/src/XGUI/pictures/filter.png
new file mode 100644 (file)
index 0000000..036428b
Binary files /dev/null and b/src/XGUI/pictures/filter.png differ
diff --git a/src/XGUI/pictures/plus_minus.png b/src/XGUI/pictures/plus_minus.png
new file mode 100644 (file)
index 0000000..9e25d17
Binary files /dev/null and b/src/XGUI/pictures/plus_minus.png differ