From: vsr Date: Sat, 7 Jun 2008 11:03:19 +0000 (+0000) Subject: Fix problems: X-Git-Tag: V5_1_0a1~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8dcf8390a4c08c3ef950bafa016a558564b22484;p=modules%2Fsmesh.git Fix problems: - too small width of Filter dialog box - allow activating filter items by single click --- diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 8ec99d3fd..7a12b1522 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -501,6 +501,8 @@ public: Table( int, int, QWidget* = 0 ); virtual ~Table(); + QSize minimumSizeHint() const; + void setEditable( bool, int, int ); bool isEditable( int, int ) const; @@ -526,6 +528,10 @@ SMESHGUI_FilterTable::Table::Table (QWidget* parent) setReadOnly( false ); } +//======================================================================= +// name : SMESHGUI_FilterTable::Table::Table +// Purpose : Constructor +//======================================================================= SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent) : QTableWidget(numRows, numCols, parent) { @@ -535,10 +541,27 @@ SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* 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 @@ -574,10 +597,7 @@ void SMESHGUI_FilterTable::Table::setReadOnly( bool on ) { setEditTriggers( on ? QAbstractItemView::NoEditTriggers : - QAbstractItemView::DoubleClicked | - QAbstractItemView::SelectedClicked | - QAbstractItemView::EditKeyPressed | - QAbstractItemView::AnyKeyPressed ); + QAbstractItemView::AllEditTriggers ); } bool SMESHGUI_FilterTable::Table::isReadOnly() const @@ -1627,7 +1647,7 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget* thePar 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);