mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-06 06:40:45 +05:00
0020898: EDF 1429 SMESH: Remove elements using "Set Filters" fails
This commit is contained in:
parent
8774b2b4ec
commit
c5b8df021f
@ -2517,31 +2517,18 @@ void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QList<int>& theIds)
|
||||
if (theWg == 0)
|
||||
return;
|
||||
|
||||
QStringList aStrList;
|
||||
foreach(int id, theIds)
|
||||
aStrList << QString::number(id);
|
||||
|
||||
if (theWg->inherits("QListWidget"))
|
||||
{
|
||||
QListWidget* aListBox = qobject_cast<QListWidget*>( theWg );
|
||||
aListBox->clear();
|
||||
|
||||
QStringList aStrList;
|
||||
QList<int>::const_iterator anIter;
|
||||
for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter)
|
||||
aStrList.append(QString("%1").arg(*anIter));
|
||||
|
||||
aListBox->addItems(aStrList);
|
||||
qobject_cast<QListWidget*>(theWg)->clear();
|
||||
qobject_cast<QListWidget*>(theWg)->addItems(aStrList);
|
||||
}
|
||||
else if (theWg->inherits("QLineEdit"))
|
||||
{
|
||||
QLineEdit* aLineEdit = qobject_cast<QLineEdit*>( theWg );
|
||||
QString aStr;
|
||||
QList<int>::const_iterator anIter;
|
||||
|
||||
for (anIter = theIds.begin(); anIter != theIds.end(); ++ anIter)
|
||||
aStr += QString("%1 ").arg(*anIter);
|
||||
|
||||
if (!aStr.isEmpty())
|
||||
aStr.remove(aStr.length() - 1, 1);
|
||||
|
||||
aLineEdit->setText(aStr);
|
||||
qobject_cast<QLineEdit*>( theWg )->setText(aStrList.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,7 @@ SMESHGUI_RemoveElementsDlg
|
||||
SelectButtonC1A1->setIcon(image1);
|
||||
LineEditC1A1 = new QLineEdit(GroupC1);
|
||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
||||
LineEditC1A1->setMaxLength(-1);
|
||||
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
||||
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
||||
|
||||
@ -232,7 +233,7 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
|
||||
bool aResult = false;
|
||||
try {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout());
|
||||
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in());
|
||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
myEditCurrentArgument->clear();
|
||||
@ -311,9 +312,6 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
||||
|
||||
myNbOkElements = 0;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// hilight entered elements
|
||||
if(myActor){
|
||||
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
||||
@ -335,12 +333,8 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
||||
}
|
||||
}
|
||||
|
||||
if (myNbOkElements) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -349,56 +343,52 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
|
||||
{
|
||||
if (myBusy) return;
|
||||
if (myBusy) return; // busy
|
||||
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active
|
||||
if (!GroupButtons->isEnabled()) return; // inactive
|
||||
|
||||
// clear
|
||||
|
||||
myNbOkElements = false;
|
||||
myNbOkElements = 0;
|
||||
myActor = 0;
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText("");
|
||||
myBusy = false;
|
||||
|
||||
if (!GroupButtons->isEnabled()) // inactive
|
||||
return;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// get selected mesh
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = aList.Extent();
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
if (nbSel == 1) {
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (!myActor)
|
||||
return;
|
||||
if (!myMesh->_is_nil()) {
|
||||
|
||||
// get selected nodes
|
||||
QString aString = "";
|
||||
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
|
||||
if(nbElems < 1)
|
||||
return;
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (myActor) {
|
||||
|
||||
// get selected nodes
|
||||
QString aString = "";
|
||||
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
|
||||
if (nbElems > 0) {
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
|
||||
// OK
|
||||
|
||||
myNbOkElements = nbElems;
|
||||
} // if (nbElems > 0)
|
||||
} // if (myActor)
|
||||
} // if (!myMesh->_is_nil())
|
||||
} // if (nbSel == 1) {
|
||||
|
||||
// OK
|
||||
|
||||
myNbOkElements = nbElems;
|
||||
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -524,3 +514,13 @@ void SMESHGUI_RemoveElementsDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateButtons
|
||||
// purpose : enable / disable control buttons
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::updateButtons()
|
||||
{
|
||||
buttonOk->setEnabled(myNbOkElements > 0);
|
||||
buttonApply->setEnabled(myNbOkElements > 0);
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ private slots:
|
||||
void ActivateThisDialog();
|
||||
void onTextChange( const QString& );
|
||||
void setFilters();
|
||||
void updateButtons();
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_REMOVEELEMENTSDLG_H
|
||||
|
@ -123,6 +123,7 @@ SMESHGUI_RemoveNodesDlg
|
||||
SelectButtonC1A1->setIcon(image1);
|
||||
LineEditC1A1 = new QLineEdit(GroupC1);
|
||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
|
||||
LineEditC1A1->setMaxLength(-1);
|
||||
QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
|
||||
connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
||||
|
||||
@ -234,7 +235,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply()
|
||||
bool aResult = false;
|
||||
try {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout());
|
||||
aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.in());
|
||||
} catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
myEditCurrentArgument->clear();
|
||||
@ -317,9 +318,6 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
||||
|
||||
myNbOkNodes = 0;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// hilight entered nodes
|
||||
if(myActor){
|
||||
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
||||
@ -341,12 +339,8 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
||||
}
|
||||
}
|
||||
|
||||
if (myNbOkNodes) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -355,56 +349,51 @@ void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText)
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument()
|
||||
{
|
||||
if (myBusy) return;
|
||||
|
||||
if (myBusy) return; // busy
|
||||
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
|
||||
if (!GroupButtons->isEnabled()) return; // inactive
|
||||
|
||||
// clear
|
||||
|
||||
myNbOkNodes = false;
|
||||
myNbOkNodes = 0;
|
||||
myActor = 0;
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText("");
|
||||
myBusy = false;
|
||||
|
||||
if (!GroupButtons->isEnabled()) // inactive
|
||||
return;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// get selected mesh
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = aList.Extent();
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
if (nbSel == 1) {
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (!myActor)
|
||||
return;
|
||||
if (!myMesh->_is_nil()) {
|
||||
|
||||
// get selected nodes
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (myActor) {
|
||||
|
||||
QString aString = "";
|
||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
|
||||
if(nbNodes < 1)
|
||||
return;
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
// get selected nodes
|
||||
QString aString = "";
|
||||
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
|
||||
if (nbNodes > 0) {
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
|
||||
// OK
|
||||
|
||||
myNbOkNodes = nbNodes;
|
||||
} // if (nbNodes > 0)
|
||||
} // if (myActor)
|
||||
} // if (!myMesh->_is_nil())
|
||||
} // if (nbSel == 1)
|
||||
|
||||
// OK
|
||||
|
||||
myNbOkNodes = true;
|
||||
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -531,3 +520,13 @@ void SMESHGUI_RemoveNodesDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateButtons
|
||||
// purpose : enable / disable control buttons
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveNodesDlg::updateButtons()
|
||||
{
|
||||
buttonOk->setEnabled(myNbOkNodes > 0);
|
||||
buttonApply->setEnabled(myNbOkNodes > 0);
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ private slots:
|
||||
void ActivateThisDialog();
|
||||
void onTextChange( const QString& );
|
||||
void setFilters();
|
||||
void updateButtons();
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_REMOVENODESDLG_H
|
||||
|
Loading…
Reference in New Issue
Block a user