X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_PropertyPanel.cpp;h=3ce0ed1713e41f3b2a26160b78c0b9e764042641;hb=b73fb7468bea81901dbeed8e229d742f788ec282;hp=3e8e67584c8e6d622abe1213c7e653ca6329ba75;hpb=0cd070a0e4106dd57c5679d5bac26a0d0afd40b5;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 3e8e67584..3ce0ed171 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include @@ -51,7 +53,6 @@ #include #include #include -#include #include #ifdef _DEBUG @@ -66,6 +67,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* th : ModuleBase_IPropertyPanel(theParent), myActiveWidget(NULL), myPreselectionWidget(NULL), + myInternalActiveWidget(NULL), myPanelPage(NULL), myOperationMgr(theMgr) { @@ -93,6 +95,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* th QStringList aBtnNames; aBtnNames << QString(PROP_PANEL_HELP) << QString(PROP_PANEL_OK) + << QString(PROP_PANEL_OK_PLUS) << QString(PROP_PANEL_CANCEL); foreach(QString eachBtnName, aBtnNames) { QToolButton* aBtn = new QToolButton(aFrm); @@ -166,7 +169,8 @@ void XGUI_PropertyPanel::cleanContent() void XGUI_PropertyPanel::setModelWidgets(const QList& theWidgets) { myWidgets = theWidgets; - if (theWidgets.empty()) return; + if (theWidgets.empty()) + return; foreach (ModuleBase_ModelWidget* aWidget, theWidgets) { connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)), this, SLOT(onFocusInWidget(ModuleBase_ModelWidget*))); @@ -176,7 +180,6 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t this, SIGNAL(keyReleased(QObject*, QKeyEvent*))); connect(aWidget, SIGNAL(enterClicked(QObject*)), this, SIGNAL(enterClicked(QObject*))); - } } @@ -223,6 +226,18 @@ void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) /// Apply button should be update if the feature was modified by the panel myOperationMgr->onValidateOperation(); } + std::shared_ptr aFeatureInfo = + myOperationMgr->workshop()->featureInfo(theFeature->getKind().c_str()); + if (aFeatureInfo.get()) + findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue()); +} + +ModuleBase_ModelWidget* XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const +{ + if (isUseCustomWidget && myInternalActiveWidget) + return myInternalActiveWidget; + + return myActiveWidget; } void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) @@ -387,8 +402,8 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) #endif ModuleBase_ModelWidget* aFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this, aFocusWidget); - if (aFocusMWidget) - aFocusMWidget->setHighlighted(false); + //if (aFocusMWidget) + // aFocusMWidget->setHighlighted(false); QWidget* aNewFocusWidget = 0; if (aFocusWidget) { @@ -396,11 +411,11 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) findDirectChildren(this, aChildren, true); int aChildrenCount = aChildren.count(); int aFocusWidgetIndex = aChildren.indexOf(aFocusWidget); + QToolButton* anOkBtn = findButton(PROP_PANEL_OK); if (aFocusWidgetIndex >= 0) { if (theIsNext) { if (aFocusWidgetIndex == aChildrenCount-1) { // after the last widget focus should be set to "Apply" - QToolButton* anOkBtn = findButton(PROP_PANEL_OK); if (anOkBtn->isEnabled()) aNewFocusWidget = anOkBtn; else { @@ -420,7 +435,6 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) } else { // before the "Apply" button, the last should accept focus for consistency with "Next" - QToolButton* anOkBtn = findButton(PROP_PANEL_OK); if (aFocusWidget == anOkBtn) { aNewFocusWidget = aChildren[aChildrenCount - 1]; } @@ -445,9 +459,13 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this, aNewFocusWidget); - if (aNewFocusMWidget) + if (aNewFocusMWidget) { + if (aFocusMWidget) { + aFocusMWidget->setHighlighted(false); + } aNewFocusMWidget->emitFocusInWidget(); - isChangedFocus = true; + isChangedFocus = true; + } } return isChangedFocus; } @@ -551,10 +569,11 @@ void XGUI_PropertyPanel::setEditingMode(bool isEditing) void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr) { QStringList aButtonNames; - aButtonNames << PROP_PANEL_OK << PROP_PANEL_CANCEL << PROP_PANEL_HELP << PROP_PANEL_PREVIEW; + aButtonNames << PROP_PANEL_OK<< PROP_PANEL_OK_PLUS << PROP_PANEL_CANCEL + << PROP_PANEL_HELP << PROP_PANEL_PREVIEW; QList aActionIds; - aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::Abort << XGUI_ActionsMgr::Help - << XGUI_ActionsMgr::Preview; + aActionIds << XGUI_ActionsMgr::Accept << XGUI_ActionsMgr::AcceptPlus << XGUI_ActionsMgr::Abort + << XGUI_ActionsMgr::Help << XGUI_ActionsMgr::Preview; for (int i = 0; i < aButtonNames.size(); ++i) { QToolButton* aBtn = findButton(aButtonNames.at(i).toStdString().c_str()); QAction* anAct = theMgr->operationStateAction(aActionIds.at(i)); @@ -562,6 +581,33 @@ void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr) } } +void XGUI_PropertyPanel::onAcceptData() +{ + foreach (ModuleBase_ModelWidget* aWidget, myWidgets) { + aWidget->onFeatureAccepted(); + } +} + +void XGUI_PropertyPanel::setInternalActiveWidget(ModuleBase_ModelWidget* theWidget) +{ + if (theWidget) + { + myInternalActiveWidget = theWidget; + emit propertyPanelActivated(); + } + else + { + if (myInternalActiveWidget) + { + delete myInternalActiveWidget; + myInternalActiveWidget = 0; + } + emit propertyPanelDeactivated(); + } + myOperationMgr->workshop()->selectionActivate()->updateSelectionModes(); + myOperationMgr->workshop()->selectionActivate()->updateSelectionFilters(); +} + ModuleBase_ModelWidget* XGUI_PropertyPanel::preselectionWidget() const { return myPreselectionWidget;