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(" "));
}
}
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()));
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();
myNbOkElements = 0;
- buttonOk->setEnabled(false);
- buttonApply->setEnabled(false);
-
// hilight entered elements
if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
}
}
- if (myNbOkElements) {
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
- }
-
myBusy = false;
+ updateButtons();
}
//=================================================================================
//=================================================================================
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;
-
- Handle(SALOME_InteractiveObject) anIO = aList.First();
- myMesh = SMESH::GetMeshByIO(anIO);
- if (myMesh->_is_nil())
- return;
-
- myActor = SMESH::FindActorByEntry(anIO->getEntry());
- if (!myActor)
- return;
-
- // get selected nodes
- QString aString = "";
- int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
- if(nbElems < 1)
- return;
- myBusy = true;
- myEditCurrentArgument->setText(aString);
- myBusy = false;
-
- // OK
-
- myNbOkElements = nbElems;
-
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
+ if (nbSel == 1) {
+
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+ myMesh = SMESH::GetMeshByIO(anIO);
+
+ if (!myMesh->_is_nil()) {
+
+ 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) {
+
+ updateButtons();
}
//=================================================================================
myFilterDlg->show();
}
+
+//=================================================================================
+// function : updateButtons
+// purpose : enable / disable control buttons
+//=================================================================================
+void SMESHGUI_RemoveElementsDlg::updateButtons()
+{
+ buttonOk->setEnabled(myNbOkElements > 0);
+ buttonApply->setEnabled(myNbOkElements > 0);
+}
void ActivateThisDialog();
void onTextChange( const QString& );
void setFilters();
+ void updateButtons();
};
#endif // SMESHGUI_REMOVEELEMENTSDLG_H
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()));
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();
myNbOkNodes = 0;
- buttonOk->setEnabled(false);
- buttonApply->setEnabled(false);
-
// hilight entered nodes
if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
}
}
- if (myNbOkNodes) {
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
- }
-
myBusy = false;
+ updateButtons();
}
//=================================================================================
//=================================================================================
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;
-
- Handle(SALOME_InteractiveObject) anIO = aList.First();
- myMesh = SMESH::GetMeshByIO(anIO);
- if (myMesh->_is_nil())
- return;
-
- myActor = SMESH::FindActorByEntry(anIO->getEntry());
- if (!myActor)
- return;
-
- // get selected nodes
-
- QString aString = "";
- int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,anIO,aString);
- if(nbNodes < 1)
- return;
- myBusy = true;
- myEditCurrentArgument->setText(aString);
- myBusy = false;
-
- // OK
-
- myNbOkNodes = true;
-
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
+ if (nbSel == 1) {
+
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+ myMesh = SMESH::GetMeshByIO(anIO);
+
+ if (!myMesh->_is_nil()) {
+
+ myActor = SMESH::FindActorByEntry(anIO->getEntry());
+ if (myActor) {
+
+ // 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)
+
+ updateButtons();
}
//=================================================================================
myFilterDlg->show();
}
+
+//=================================================================================
+// function : updateButtons
+// purpose : enable / disable control buttons
+//=================================================================================
+void SMESHGUI_RemoveNodesDlg::updateButtons()
+{
+ buttonOk->setEnabled(myNbOkNodes > 0);
+ buttonApply->setEnabled(myNbOkNodes > 0);
+}
void ActivateThisDialog();
void onTextChange( const QString& );
void setFilters();
+ void updateButtons();
};
#endif // SMESHGUI_REMOVENODESDLG_H