Salome HOME
Fix problems:
authorvsr <vsr@opencascade.com>
Sat, 7 Jun 2008 11:03:19 +0000 (11:03 +0000)
committervsr <vsr@opencascade.com>
Sat, 7 Jun 2008 11:03:19 +0000 (11:03 +0000)
- too small width of Filter dialog box
- allow activating filter items by single click

src/SMESHGUI/SMESHGUI_FilterDlg.cxx

index 8ec99d3fd3e80bd6dc962112594f816d9ec7dc43..7a12b1522513b79a55d1ed46ca6e13f44c6cee24 100755 (executable)
@@ -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);