Changes for bug IPAL19574.

This commit is contained in:
skl 2008-07-04 11:02:20 +00:00
parent 4112f94a38
commit 779689b9a7
2 changed files with 22 additions and 2 deletions

View File

@ -110,6 +110,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
myIsBusy( false ), myIsBusy( false ),
myNameChanged(false),
myActor( 0 ) myActor( 0 )
{ {
if (!name) setName("SMESHGUI_GroupDlg"); if (!name) setName("SMESHGUI_GroupDlg");
@ -135,7 +136,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
myIsBusy( false ) myIsBusy( false ),
myNameChanged(false)
{ {
if (!name) setName("SMESHGUI_GroupDlg"); if (!name) setName("SMESHGUI_GroupDlg");
@ -521,7 +523,10 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
myMesh = theGroup->GetMesh(); myMesh = theGroup->GetMesh();
setShowEntityMode(); setShowEntityMode();
myNameChanged = true;
myName->blockSignals(true);
myName->setText(theGroup->GetName()); myName->setText(theGroup->GetName());
myName->blockSignals(false);
myName->home(false); myName->home(false);
SALOMEDS::Color aColor = theGroup->GetColor(); SALOMEDS::Color aColor = theGroup->GetColor();
@ -603,7 +608,10 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
aShapeName = aGroupShapeSO->GetName().c_str(); aShapeName = aGroupShapeSO->GetName().c_str();
} }
myGeomGroupLine->setText( aShapeName ); myGeomGroupLine->setText( aShapeName );
myNameChanged = true;
myName->blockSignals(true);
myName->setText("Group On " + aShapeName); myName->setText("Group On " + aShapeName);
myName->blockSignals(false);
} }
} }
} }
@ -641,6 +649,12 @@ void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
{ {
myOldName = myName->text(); myOldName = myName->text();
updateButtons(); updateButtons();
QString tmp = myName->text();
tmp.stripWhiteSpace();
if( !tmp.isEmpty() )
myNameChanged = true;
else
myNameChanged = false;
} }
//================================================================================= //=================================================================================
@ -666,7 +680,9 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
{ {
if (myGrpTypeId != id) { if (myGrpTypeId != id) {
myWGStack->raiseWidget( id ); myWGStack->raiseWidget( id );
myName->blockSignals(true);
myName->setText(myOldName); myName->setText(myOldName);
myName->blockSignals(false);
onSelectGeomGroup(id == 1); onSelectGeomGroup(id == 1);
} }
myGrpTypeId = id; myGrpTypeId = id;
@ -1193,9 +1209,11 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
// change name of group only if it is empty // change name of group only if it is empty
QString tmp = myName->text(); QString tmp = myName->text();
tmp.stripWhiteSpace(); tmp.stripWhiteSpace();
if(tmp.isEmpty()) { if( tmp.isEmpty() || !myNameChanged ) {
myOldName = myName->text(); myOldName = myName->text();
myName->blockSignals(true);
myName->setText(aString); myName->setText(aString);
myName->blockSignals(false);
} }
updateButtons(); updateButtons();

View File

@ -203,6 +203,8 @@ private:
bool myCreate, myIsBusy; bool myCreate, myIsBusy;
QString myHelpFileName; QString myHelpFileName;
bool myNameChanged; //added by skl for IPAL19574
}; };
#endif // DIALOGBOX_GROUP_H #endif // DIALOGBOX_GROUP_H