//
#include <ModuleBase_WidgetMultiSelector.h>
-#include <ModuleBase_WidgetShapeSelector.h>
+
+#include <ModuleBase_ActionIntParameter.h>
+#include <ModuleBase_Definitions.h>
+#include <ModuleBase_Events.h>
+#include <ModuleBase_IconFactory.h>
+#include <ModuleBase_IModule.h>
#include <ModuleBase_ISelection.h>
-#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ISelectionActivate.h>
+ #include <ModuleBase_IPropertyPanel.h>
#include <ModuleBase_IViewer.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ListView.h>
#include <ModuleBase_Tools.h>
-#include <ModuleBase_Definitions.h>
-#include <ModuleBase_IModule.h>
#include <ModuleBase_ViewerPrs.h>
-#include <ModuleBase_IconFactory.h>
-#include <ModuleBase_Events.h>
+#include <ModuleBase_WidgetShapeSelector.h>
+ #include <ModuleBase_ChoiceCtrl.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
//aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
//aMainLay->setRowMinimumHeight(3, 20);
//this->setLayout(aMainLay);
- connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
+ connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
- myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"),
- myWorkshop->desktop(), this, SLOT(onCopyItem()));
- myCopyAction->setShortcut(QKeySequence::Copy);
- myCopyAction->setEnabled(false);
- myListControl->addAction(myCopyAction);
-
- myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"),
- myWorkshop->desktop(), this, SLOT(onDeleteItem()));
- myDeleteAction->setEnabled(false);
- myListControl->addAction(myDeleteAction);
-
- myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
- connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
-
myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
}
QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
{
QList<QWidget*> result;
- //result << myTypeCombo;
- result << myListControl;
+ result << myListView->getControl();
return result;
}
{
QString aShapeTypeName;
- for (int idx = 0; idx < myTypeCombo->count(); ++idx) {
- aShapeTypeName = myTypeCombo->itemText(idx);
+ int idx = 0;
+ foreach (QString aShapeTypeName, myShapeTypes) {
int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
- if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
+ if(aRefType == theShapeType && idx != myTypeCtrl->value()) {
- bool aWasActivated = activateSelectionAndFilters(false);
+ updateSelectionModesAndFilters(false);
- bool isBlocked = myTypeCombo->blockSignals(true);
- myTypeCombo->setCurrentIndex(idx);
- myTypeCombo->blockSignals(isBlocked);
+ bool isBlocked = myTypeCtrl->blockSignals(true);
+ myTypeCtrl->setValue(idx);
+ myTypeCtrl->blockSignals(isBlocked);
- if (aWasActivated)
- activateSelectionAndFilters(true);
+ updateSelectionModesAndFilters(true);
break;
}
+ idx++;
}
}
#include <QMap>
class QWidget;
- class QComboBox;
-class QListWidget;
+ //class QComboBox;
+class ModuleBase_ListView;
class ModuleBase_IWorkshop;
-class QAction;
+ class ModuleBase_ChoiceCtrl;
-
/**
* \ingroup GUI
* Implementation of widget for shapes selection. This widget provides selection of several shapes.
ModuleBase_IWorkshop* theWorkshop);
protected:
- /// List control
- QListWidget* myListControl;
+ ModuleBase_ListView* myListView; ///< List control
- QComboBox* myTypeCombo; ///< Combobox of types
- bool myIsUseChoice; /// A flag to store use_choice parameter state
++
++ bool myIsUseChoice; ///< A flag to store use_choice parameter state
+
- QStringList myShapeTypes;
++ QStringList myShapeTypes; ///< List of Shape types defined in XML
+
+ /// Control for types
+ ModuleBase_ChoiceCtrl* myTypeCtrl;
- /// Provides correspondance between Result object and its shape
- typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
-
- /// A copy action for pop-up menu in a list control
- QAction* myCopyAction;
-
- /// A delete action for pop-up menu in a list control
- QAction* myDeleteAction;
-
- /// 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;
enum OperationStateActionId {
Abort = 0,
Accept = 1,
- Help = 2,
- AbortAll = 3,
- AcceptAll = 4,
- Preview = 5
+ AcceptPlus = 2,
+ Help = 3,
+ AbortAll = 4,
+ AcceptAll = 5,
+ Preview = 6
};
- //! Add a command in the manager.
- //! Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions)
- //! won't be extracted and should be added manually using the addNestedCommands method.
+ /// Add a command in the manager.
+ /// Please note that nested commands in the Salome mode (No AppElements_Command, pure QActions)
+ /// won't be extracted and should be added manually using the addNestedCommands method.
void addCommand(QAction* theCmd);
- //! Sets relation between the command (with given Id) and it's nested actions.
+ /// Sets relation between the command (with given Id) and it's nested actions.
void addNestedCommands(const QString& theId, const QStringList& theCommands);
- //! Returns list of nested commands by parent command Id
- //! \param theId a parent command Id
+ /// Returns list of nested commands by parent command Id
+ /// \param theId a parent command Id
QStringList nestedCommands(const QString& theId) const;
/// Returns True if the given Id is an Id of nested command