INT PAL 0052872: 'Make 0D Elements on Element Nodes' dialog does not restore local selection of nodes and elements.

This commit is contained in:
imn 2016-02-19 16:35:12 +03:00
parent 5218291db4
commit fe79fa3921
4 changed files with 199 additions and 21 deletions

View File

@ -78,13 +78,13 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
// Seletction type radio buttons // Seletction type radio buttons
QGroupBox* selTypeGrBox = new QGroupBox( mainFrame() ); mySelTypeGrBox = new QGroupBox( mainFrame() );
// //
QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),selTypeGrBox ); QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),mySelTypeGrBox );
QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),selTypeGrBox ); QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),mySelTypeGrBox );
QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),selTypeGrBox ); QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),mySelTypeGrBox );
// //
QHBoxLayout* selTypeLay = new QHBoxLayout( selTypeGrBox ); QHBoxLayout* selTypeLay = new QHBoxLayout( mySelTypeGrBox );
selTypeLay->setMargin(MARGIN); selTypeLay->setMargin(MARGIN);
selTypeLay->setSpacing(SPACING); selTypeLay->setSpacing(SPACING);
selTypeLay->addWidget( objBtn ); selTypeLay->addWidget( objBtn );
@ -126,7 +126,7 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
aLay->setMargin(MARGIN); aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING); aLay->setSpacing(SPACING);
// //
aLay->addWidget( selTypeGrBox, 0, 0, 1, 5 ); aLay->addWidget( mySelTypeGrBox, 0, 0, 1, 5 );
// //
aLay->addWidget( objectWg( 0, Label ), 1, 0 ); aLay->addWidget( objectWg( 0, Label ), 1, 0 );
aLay->addWidget( objectWg( 0, Btn ), 1, 1 ); aLay->addWidget( objectWg( 0, Btn ), 1, 1 );
@ -137,9 +137,10 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
// Signals // Signals
connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked() )); connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked( bool ) ));
connect( mySelTypeBtnGrp, SIGNAL( buttonClicked(int) ), SLOT( onSelTypeChange(int))); connect( mySelTypeBtnGrp, SIGNAL( buttonClicked(int) ), SLOT( onSelTypeChange(int)));
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ),
this, SLOT( DeactivateActiveDialog() ) );
onSelTypeChange( SEL_OBJECT ); onSelTypeChange( SEL_OBJECT );
} }
@ -193,6 +194,67 @@ int SMESHGUI_Add0DElemsOnAllNodesDlg::getSelectionType() const
return mySelTypeBtnGrp->checkedId(); return mySelTypeBtnGrp->checkedId();
} }
//=================================================================================
/*!
\brief Reactivate dialog box, when mouse pointer goes into it.
*/
//=================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::enterEvent( QEvent* event)
{
ActivateThisDialog();
}
//=================================================================================
/*!
* \brief SLOT to deactivate dialog
*/
//=================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::DeactivateActiveDialog()
{
if (myGroupBox->isEnabled()) {
mySelTypeGrBox->setEnabled(false);
myGroupBox->setEnabled(false);
myGroupLabel->setEnabled(false);
myGroupListCmBox->setEnabled(false);
myFilterBtn->setEnabled(false);
objectWg( 0, Label )->setEnabled(false);
objectWg( 0, Btn )->setEnabled(false);
objectWg( 0, Control )->setEnabled(false);
button( QtxDialog::OK )->setEnabled(false);
button( QtxDialog::Apply )->setEnabled(false);
button( QtxDialog::Close )->setEnabled(false);
button( QtxDialog::Help )->setEnabled(false);
setObjectText( 0, "" );
SMESHGUI::GetSMESHGUI()->ResetState();
SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(0);
}
}
//=================================================================================
/*!
* \brief SLOT to activate dialog
*/
//=================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::ActivateThisDialog()
{
if (!myGroupBox->isEnabled()) {
SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this );
mySelTypeGrBox->setEnabled(true);
myGroupBox->setEnabled(true);
myGroupLabel->setEnabled(true);
myGroupListCmBox->setEnabled(true);
myFilterBtn->setEnabled(true);
objectWg( 0, Label )->setEnabled(true);
objectWg( 0, Btn )->setEnabled(true);
objectWg( 0, Control )->setEnabled(true);
button( QtxDialog::OK )->setEnabled(true);
button( QtxDialog::Apply )->setEnabled(true);
button( QtxDialog::Close )->setEnabled(true);
button( QtxDialog::Help )->setEnabled(true);
}
emit selTypeChanged( getSelectionType() );
}
//================================================================================ //================================================================================
/*! /*!
* \brief Checks consistency of data * \brief Checks consistency of data
@ -270,15 +332,16 @@ void SMESHGUI_Add0DElemsOnAllNodesOp::selectionDone()
if (!myDlg->myGroupBox->isEnabled()) return; // inactive if (!myDlg->myGroupBox->isEnabled()) return; // inactive
myIO.Nullify(); myIO.Nullify();
myDlg->setObjectText( 0, "");
updateButtons(); updateButtons();
SALOME_ListIO aList; SALOME_ListIO aList;
selectionMgr()->selectedObjects( aList ); selectionMgr()->selectedObjects( aList );
if ( aList.Extent() == 1 ) if ( aList.Extent() == 1 )
myIO = aList.First(); myIO = aList.First();
else else {
myDlg->setObjectText( 0, "" );
return; return;
}
QString ids; QString ids;
switch ( myDlg->getSelectionType() ) { switch ( myDlg->getSelectionType() ) {

View File

@ -57,18 +57,25 @@ signals:
void selTypeChanged( int selType ); void selTypeChanged( int selType );
protected:
virtual void enterEvent( QEvent* );
private slots: private slots:
void onGroupChecked ( bool on ); void onGroupChecked ( bool on );
void onSelTypeChange( int selType ); void onSelTypeChange( int selType );
void ActivateThisDialog();
void DeactivateActiveDialog();
private: private:
friend class SMESHGUI_Add0DElemsOnAllNodesOp; friend class SMESHGUI_Add0DElemsOnAllNodesOp;
QButtonGroup* mySelTypeBtnGrp; QButtonGroup* mySelTypeBtnGrp;
QPushButton* myFilterBtn; QPushButton* myFilterBtn;
QGroupBox* mySelTypeGrBox;
QGroupBox* myGroupBox; QGroupBox* myGroupBox;
QLabel* myGroupLabel; QLabel* myGroupLabel;
QComboBox* myGroupListCmBox; QComboBox* myGroupListCmBox;

View File

@ -122,15 +122,15 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT"))); QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT")));
// constructor // constructor
QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), this); myGroupBox = new QGroupBox(tr("MOVE_NODE"), this);
aPixGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myButtonGroup = new QButtonGroup(this); myButtonGroup = new QButtonGroup(this);
QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); QHBoxLayout* aPixGrpLayout = new QHBoxLayout(myGroupBox);
aPixGrpLayout->setMargin(MARGIN); aPixGrpLayout->setMargin(MARGIN);
aPixGrpLayout->setSpacing(SPACING); aPixGrpLayout->setSpacing(SPACING);
myRButNodeToMove = new QRadioButton(aPixGrp); myRButNodeToMove = new QRadioButton(myGroupBox);
myRButMoveWithoutNode = new QRadioButton(aPixGrp); myRButMoveWithoutNode = new QRadioButton(myGroupBox);
myRButNodeToMove->setIcon(iconMoveNode); myRButNodeToMove->setIcon(iconMoveNode);
myRButMoveWithoutNode->setIcon(iconMoveWithoutNode); myRButMoveWithoutNode->setIcon(iconMoveWithoutNode);
myRButNodeToMove->setChecked(true); myRButNodeToMove->setChecked(true);
@ -260,7 +260,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
myPreviewChkBox = new QCheckBox( tr("PREVIEW"), aFrame); myPreviewChkBox = new QCheckBox( tr("PREVIEW"), aFrame);
QVBoxLayout* aLay = new QVBoxLayout(aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame);
aLay->addWidget(aPixGrp); aLay->addWidget(myGroupBox);
aLay->addWidget(myNodeToMoveGrp); aLay->addWidget(myNodeToMoveGrp);
aLay->addWidget(myDestinationGrp); aLay->addWidget(myDestinationGrp);
aLay->addWidget(myPreviewChkBox); aLay->addWidget(myPreviewChkBox);
@ -268,6 +268,8 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent)
connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool)));
connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int))); connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int)));
connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalDeactivateActiveDialog()),
this, SLOT(DeactivateActiveDialog()));
myIdBtn->setChecked(true); myIdBtn->setChecked(true);
@ -343,6 +345,59 @@ void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId)
resize(minimumSizeHint()); resize(minimumSizeHint());
} }
//=================================================================================
/*!
\brief Reactivate dialog box, when mouse pointer goes into it.
*/
//=================================================================================
void SMESHGUI_MakeNodeAtPointDlg::enterEvent( QEvent* event)
{
ActivateThisDialog();
}
//=================================================================================
/*!
* \brief SLOT to deactivate dialog
*/
//=================================================================================
void SMESHGUI_MakeNodeAtPointDlg::DeactivateActiveDialog()
{
if (myGroupBox->isEnabled()) {
myGroupBox->setEnabled(false);
myNodeToMoveGrp->setEnabled(false);
myDestinationGrp->setEnabled(false);
myPreviewChkBox->setEnabled(false);
button( QtxDialog::OK )->setEnabled(false);
button( QtxDialog::Apply )->setEnabled(false);
button( QtxDialog::Close )->setEnabled(false);
button( QtxDialog::Help )->setEnabled(false);
SMESHGUI::GetSMESHGUI()->ResetState();
SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(0);
emit deactivatedDialog();
}
}
//=================================================================================
/*!
* \brief SLOT to activate dialog
*/
//=================================================================================
void SMESHGUI_MakeNodeAtPointDlg::ActivateThisDialog()
{
if (!myGroupBox->isEnabled()) {
myGroupBox->setEnabled(true);
myNodeToMoveGrp->setEnabled(true);
myDestinationGrp->setEnabled(true);
myPreviewChkBox->setEnabled(true);
button( QtxDialog::OK )->setEnabled(true);
button( QtxDialog::Apply )->setEnabled(true);
button( QtxDialog::Close )->setEnabled(true);
button( QtxDialog::Help )->setEnabled(true);
emit activatedDialog();
}
}
//================================================================================ //================================================================================
/*! /*!
* \brief Constructor * \brief Constructor
@ -376,6 +431,8 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
// note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class // note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class
connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(onTextChange(const QString&))); connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(onTextChange(const QString&)));
connect(myDlg->myUpdateBtn, SIGNAL (clicked()), this, SLOT(onUpdateDestination())); connect(myDlg->myUpdateBtn, SIGNAL (clicked()), this, SLOT(onUpdateDestination()));
connect(myDlg, SIGNAL (activatedDialog()), this, SLOT(onActivatedDialog()));
connect(myDlg, SIGNAL (deactivatedDialog()), this, SLOT(onDeactivatedDialog()));
} }
void SMESHGUI_MakeNodeAtPointOp::onUpdateDestination() void SMESHGUI_MakeNodeAtPointOp::onUpdateDestination()
@ -605,7 +662,6 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
{ {
if ( !myDlg->isVisible() || !myDlg->isEnabled() ) if ( !myDlg->isVisible() || !myDlg->isEnabled() )
return; return;
myNoPreview = true; myNoPreview = true;
try { try {
SALOME_ListIO aList; SALOME_ListIO aList;
@ -699,7 +755,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
bool moveShown = false; bool moveShown = false;
if ( myMeshActor) if ( myMeshActor)
{ {
const bool isPreview = myDlg->myPreviewChkBox->isChecked(); const bool isPreview = myDlg->myPreviewChkBox->isChecked() && myDlg->myPreviewChkBox->isEnabled();
const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked(); const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked();
QString msg; QString msg;
if ( isValid( msg ) ) if ( isValid( msg ) )
@ -850,6 +906,46 @@ void SMESHGUI_MakeNodeAtPointOp::onCloseView()
mySimulation = 0; mySimulation = 0;
} }
//=================================================================================
/*!
* \brief SLOT called when the activated dialog
*/
//=================================================================================
void SMESHGUI_MakeNodeAtPointOp::onActivatedDialog()
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() ) );
vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
aProp->SetColor(250, 0, 250);
aProp->SetPointSize(5);
aProp->SetLineWidth( SMESH::GetFloat("SMESH:element_width",1) + 1);
mySimulation->GetActor()->SetProperty(aProp);
aProp->Delete();
SMESHGUI_SelectionOp::startOperation();
SMESH::SetPointRepresentation( true );
onSelectionDone();
}
//=================================================================================
/*!
* \brief SLOT called when the deactivated dialog
*/
//=================================================================================
void SMESHGUI_MakeNodeAtPointOp::onDeactivatedDialog()
{
if ( mySimulation )
{
mySimulation->SetVisibility(false);
delete mySimulation;
mySimulation = 0;
}
if ( myMeshActor ) {
myMeshActor = 0;
}
SMESH::SetPointRepresentation( false );
SMESHGUI_SelectionOp::stopOperation();
}
//================================================================================ //================================================================================
/*! /*!
* \brief SLOT called when the node id is manually changed * \brief SLOT called when the node id is manually changed

View File

@ -75,6 +75,8 @@ private slots:
void onDestCoordChanged(); void onDestCoordChanged();
void onOpenView(); void onOpenView();
void onCloseView(); void onCloseView();
void onActivatedDialog();
void onDeactivatedDialog();
private: private:
int GetConstructorId(); int GetConstructorId();
@ -107,6 +109,7 @@ private:
QWidget* myMainFrame; QWidget* myMainFrame;
QGroupBox* myGroupBox;
QButtonGroup* myButtonGroup; QButtonGroup* myButtonGroup;
QRadioButton* myRButNodeToMove; QRadioButton* myRButNodeToMove;
QRadioButton* myRButMoveWithoutNode; QRadioButton* myRButMoveWithoutNode;
@ -134,9 +137,18 @@ private:
friend class SMESHGUI_MakeNodeAtPointOp; friend class SMESHGUI_MakeNodeAtPointOp;
protected:
virtual void enterEvent( QEvent* );
signals:
void activatedDialog();
void deactivatedDialog();
private slots: private slots:
void ButtonToggled( bool ); void ButtonToggled( bool );
void ConstructorsClicked( int ); void ConstructorsClicked( int );
void ActivateThisDialog();
void DeactivateActiveDialog();
}; };
#endif // SMESHGUI_MAKENODEATPOINTDLG_H #endif // SMESHGUI_MAKENODEATPOINTDLG_H