Table( int, int, QWidget* = 0 );
virtual ~Table();
+ QSize minimumSizeHint() const;
+
void setEditable( bool, int, int );
bool isEditable( int, int ) const;
setReadOnly( false );
}
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::Table
+// Purpose : Constructor
+//=======================================================================
SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent)
: QTableWidget(numRows, numCols, parent)
{
setReadOnly( false );
}
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::~Table
+// Purpose : Destructor
+//=======================================================================
SMESHGUI_FilterTable::Table::~Table()
{
}
+//=======================================================================
+// name : SMESHGUI_FilterTable::Table::minimumSizeHint
+// Purpose : Get minimum size for the table
+//=======================================================================
+QSize SMESHGUI_FilterTable::Table::minimumSizeHint() const
+{
+ QSize s = QTableWidget::minimumSizeHint();
+ QHeaderView* hv = horizontalHeader();
+ if ( hv )
+ s.setWidth( qMax( s.width(), hv->length() ) );
+ return s;
+}
+
//=======================================================================
// name : SMESHGUI_FilterTable::Table::setEditable
// Purpose : Set editable of specified cell
{
QTableWidgetItem* anItem = item( row, col );
if ( anItem ) {
+ bool isSignalsBlocked = signalsBlocked();
+ blockSignals( true );
+
Qt::ItemFlags f = anItem->flags();
if ( !isEditable ) f = f & ~Qt::ItemIsEditable;
else f = f | Qt::ItemIsEditable;
anItem->setFlags( f );
+
+ blockSignals( isSignalsBlocked );
}
}
{
setEditTriggers( on ?
QAbstractItemView::NoEditTriggers :
- QAbstractItemView::DoubleClicked |
- QAbstractItemView::SelectedClicked |
- QAbstractItemView::EditKeyPressed |
- QAbstractItemView::AnyKeyPressed );
+ QAbstractItemView::AllEditTriggers );
}
bool SMESHGUI_FilterTable::Table::isReadOnly() const
{
- return editTriggers() != QAbstractItemView::NoEditTriggers;
+ return editTriggers() == QAbstractItemView::NoEditTriggers;
}
//=======================================================================
// layout widgets
QGridLayout* aLay = new QGridLayout(myTableGrp);
- aLay->setMargin(0);
+ aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
aLay->addWidget(mySwitchTableGrp, 0, 0, 7, 1);
}
else
{
- theCriterion.ThresholdStr = aTable->text(theRow, 2).toLatin1().data();
+ theCriterion.ThresholdStr = aTable->text(theRow, 2).toLatin1().constData();
if ( aCriterionType != SMESH::FT_RangeOfIds )
- theCriterion.ThresholdID = aTable->text( theRow, 5 ).toLatin1().data();
+ theCriterion.ThresholdID = aTable->text( theRow, 5 ).toLatin1().constData();
}
QTableWidgetItem* anItem = aTable->item(theRow, 0);
aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges ||
aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume)
{
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+
if (aCompareItem->count() > 0)
aCompareItem->clear();
+ aTable->setEditable(false, row, 1);
aTable->setEditable(false, row, 2);
+
+ aTable->blockSignals( isSignalsBlocked );
}
else if (aCriterionType == SMESH::FT_RangeOfIds ||
aCriterionType == SMESH::FT_BelongToGeom ||
QMap<int, QString> aMap;
aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO");
aCompareItem->setItems(aMap);
+ if (!aTable->isEditable(row, 2))
+ aTable->setEditable(true, row, 1);
if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2);
}
bool isOk = false;
aText.toDouble(&isOk);
aTable->item( row, 2 )->setText(isOk ? aText : QString(""));
+ if (!aTable->isEditable(row, 1))
+ aTable->setEditable(true, row, 1);
if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2);
}
// Logical operation AND / OR
theTable->setItem(aCurrRow, 4, new QTableWidgetItem());
+ theTable->setItem(aCurrRow, 5, new QTableWidgetItem());
+
theTable->blockSignals( isSignalsBlocked );
// Logical binary operation for previous value
}
theTable->setEditable(false, theTable->rowCount() - 1, 4);
-
+
if (aCurrRow >=0 && aCurrRow < theTable->rowCount() &&
aCurrCol >=0 && aCurrCol < theTable->rowCount())
theTable->setCurrentCell(aCurrRow, aCurrCol);
aHeaderLabels.append( tr("BINARY") + " " );
aHeaderLabels.append( tr("ID") );
aTable->setHorizontalHeaderLabels( aHeaderLabels );
-
+
// set geometry of the table
for (int i = 0; i <= 4; i++)
aTable->resizeColumnToContents(i);
{
anIter.value()->setReadOnly(!isEditable);
+ // Set Flags for CheckItems directly IPAL 19974
+ Table* aTable = anIter.value();
+ for (int i = 0, n = aTable->rowCount(); i < n; i++)
+ for (int j = 0, m = aTable->columnCount(); j < m; j++)
+ {
+ QTableWidgetItem* anItem = aTable->item(i, j);
+ if ( dynamic_cast<SMESHGUI_FilterTable::CheckItem*>( anItem ) ) {
+ Qt::ItemFlags f = anItem->flags();
+ if (!isEditable) f = f & ~Qt::ItemIsUserCheckable;
+ else f = f | Qt::ItemIsUserCheckable;
+ anItem->setFlags( f );
+ }
+ }
+ //end of IPAL19974
+
if (isEditable)
{
myAddBtn->show();
aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
- myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp);
- myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
- myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
- myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
- myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
+ myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp);
+ myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
+ myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
+ myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
+ myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
aLay->addWidget(myButtons[ BTN_OK ]);
aLay->addSpacing(10);
myTable->GetThreshold(i, aName);
std::vector<_PTR(SObject)> aList =
- SMESH::GetActiveStudyDocument()->FindObjectByName(aName.toLatin1().data(), "GEOM");
+ SMESH::GetActiveStudyDocument()->FindObjectByName(aName.toLatin1().constData(), "GEOM");
if (aList.size() == 0) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
tr("BAD_SHAPE_NAME").arg(aName));
// name : SMESHGUI_FilterDlg::SetGroupIds
// Purpose : Set mesh
//=======================================================================
-void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_ptr theMesh)
+void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
myMesh = theMesh;
+ if ( myMesh->_is_nil() ) {
+ myButtons[BTN_OK]->setEnabled(false);
+ myButtons[BTN_Apply]->setEnabled(false);
+ }
}
//=======================================================================
int aRow, aCol;
const SALOME_ListIO& aList = mySelector->StoredIObjects();
+ if ( myMesh->_is_nil() && aList.Extent()>0 ) {
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First());
+ if ( !(myMesh->_is_nil()) ) {
+ myButtons[BTN_OK]->setEnabled(true);
+ myButtons[BTN_Apply]->setEnabled(true);
+ }
+ }
+
if (aList.Extent() != 1 ||
!myTable->CurrentCell(aRow, aCol) ||
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
}
}
+
//=======================================================================
// name : SMESHGUI_FilterDlg::onCriterionChanged
// Purpose : SLOT called when cretarion of current row changed. Update selection