Fix problems:

- too small width of Filter dialog box
- allow activating filter items by single click
This commit is contained in:
vsr 2008-06-07 11:03:19 +00:00
parent f8dd22cb6e
commit 8dcf8390a4

View File

@ -501,6 +501,8 @@ public:
Table( int, int, QWidget* = 0 ); Table( int, int, QWidget* = 0 );
virtual ~Table(); virtual ~Table();
QSize minimumSizeHint() const;
void setEditable( bool, int, int ); void setEditable( bool, int, int );
bool isEditable( int, int ) const; bool isEditable( int, int ) const;
@ -526,6 +528,10 @@ SMESHGUI_FilterTable::Table::Table (QWidget* parent)
setReadOnly( false ); setReadOnly( false );
} }
//=======================================================================
// name : SMESHGUI_FilterTable::Table::Table
// Purpose : Constructor
//=======================================================================
SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent) SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent)
: QTableWidget(numRows, numCols, parent) : QTableWidget(numRows, numCols, parent)
{ {
@ -535,10 +541,27 @@ SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent)
setReadOnly( false ); setReadOnly( false );
} }
//=======================================================================
// name : SMESHGUI_FilterTable::Table::~Table
// Purpose : Destructor
//=======================================================================
SMESHGUI_FilterTable::Table::~Table() 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 // name : SMESHGUI_FilterTable::Table::setEditable
// Purpose : Set editable of specified cell // Purpose : Set editable of specified cell
@ -574,10 +597,7 @@ void SMESHGUI_FilterTable::Table::setReadOnly( bool on )
{ {
setEditTriggers( on ? setEditTriggers( on ?
QAbstractItemView::NoEditTriggers : QAbstractItemView::NoEditTriggers :
QAbstractItemView::DoubleClicked | QAbstractItemView::AllEditTriggers );
QAbstractItemView::SelectedClicked |
QAbstractItemView::EditKeyPressed |
QAbstractItemView::AnyKeyPressed );
} }
bool SMESHGUI_FilterTable::Table::isReadOnly() const bool SMESHGUI_FilterTable::Table::isReadOnly() const