- if ( aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
- aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges ||
- aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume )
- {
- if ( aCompareItem->count() > 0 )
- aCompareItem->setStringList( QStringList() );
- aTable->SetEditable( false, row, 2 );
- }
- else if ( aCriterionType == SMESH::FT_RangeOfIds ||
- aCriterionType == SMESH::FT_BelongToGeom ||
- aCriterionType == SMESH::FT_BelongToPlane ||
- aCriterionType == SMESH::FT_BelongToCylinder ||
- aCriterionType == SMESH::FT_LyingOnGeom)
+ int aCriterionType = GetCriterionType(row);
+ QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(row, 2));
+ int aComboType = ComboItem::Type();
+ QTableWidgetItem* aTableItem = aTable->item(row, 2);
+ bool isComboItem = false;
+ if (aTableItem) {
+ int aTableType = aTable->item(row, 2)->type();
+ isComboItem = aTableType == aComboType ? true : false;
+ }
+
+ if ( (aCriterionType != SMESH::FT_GroupColor && clrBtn) ||
+ (aCriterionType != SMESH::FT_ElemGeomType && isComboItem) )
+ {
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+ aTable->removeCellWidget( row, 2 );
+ aTable->setItem( row, 2, new QTableWidgetItem() );
+ aTable->blockSignals( isSignalsBlocked );
+ }
+ if ( (aCriterionType == SMESH::FT_GroupColor && !clrBtn) ||
+ (aCriterionType == SMESH::FT_ElemGeomType && !isComboItem) )
+ {
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+ if ( aCriterionType == SMESH::FT_GroupColor )
+ aTable->setCellWidget( row, 2, new QtxColorButton( aTable ) );
+ else {
+ QList<int> typeIds = geomTypes( aType );
+ QMap<int, QString> typeNames;
+ QList<int>::const_iterator anIter = typeIds.begin();
+ for ( int i = 0; anIter != typeIds.end(); ++anIter, ++i)
+ {
+ QString typeKey = QString( "GEOM_TYPE_%1" ).arg( *anIter );
+ typeNames[ *anIter ] = tr( typeKey.toLatin1().data() );
+ }
+ ComboItem* typeBox = new ComboItem( typeNames );
+ aTable->setItem( row, 2, typeBox );
+ }
+ aTable->blockSignals( isSignalsBlocked );
+ }
+
+ if (aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ||
+ aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
+ aType == SMESH::FACE && (aCriterionType == SMESH::FT_FreeEdges ||
+ aCriterionType == SMESH::FT_FreeFaces) ||
+ aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume ||
+ aCriterionType == SMESH::FT_LinearOrQuadratic ||
+ aCriterionType == SMESH::FT_GroupColor ||
+ aCriterionType == SMESH::FT_ElemGeomType)
+ {
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+
+ if (aCompareItem->count() > 0)
+ aCompareItem->clear();
+ aTable->setEditable(false, row, 1);
+ aTable->setEditable(aCriterionType == SMESH::FT_GroupColor ||
+ aCriterionType == SMESH::FT_ElemGeomType, row, 2);
+ aTable->blockSignals( isSignalsBlocked );
+ }
+ else if (aCriterionType == SMESH::FT_RangeOfIds ||
+ aCriterionType == SMESH::FT_BelongToGeom ||
+ aCriterionType == SMESH::FT_BelongToPlane ||
+ aCriterionType == SMESH::FT_BelongToCylinder ||
+ aCriterionType == SMESH::FT_BelongToGenSurface ||
+ aCriterionType == SMESH::FT_LyingOnGeom)