]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #717: crash after Strickler coefficient addition
authorasl <asl@opencascade.com>
Wed, 18 Nov 2015 05:07:10 +0000 (08:07 +0300)
committerasl <asl@opencascade.com>
Wed, 18 Nov 2015 05:07:10 +0000 (08:07 +0300)
src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx

index 85897ffeea60ec70554f3043e3d47c603061ce26..f98053b38aed65ea603c180000a784649b64e73d 100644 (file)
@@ -86,6 +86,8 @@ QSize HYDROGUI_ColorDelegate::sizeHint( const QStyleOptionViewItem& theOption, c
 
 
 
+const int COLUMNS_COUNT = 4;
+
 
 HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModule, const QString& theTitle, int theType )
 : HYDROGUI_InputPanel( theModule, theTitle ),
@@ -161,7 +163,7 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu
         QAbstractItemView::SelectedClicked |
         QAbstractItemView::EditKeyPressed );
 
-    myTable->setColumnCount( 4 );
+    myTable->setColumnCount( COLUMNS_COUNT );
     QStringList aColumnNames;
     aColumnNames << tr( "STRICKLER_TYPE" ) << tr( "STRICKLER_COEFFICIENT" ) << tr( "ATTR_VALUE" ) << tr( "COLOR" );
     myTable->setHorizontalHeaderLabels( aColumnNames );
@@ -371,6 +373,11 @@ void HYDROGUI_StricklerTableDlg::onAddCoefficient()
     int aRow = myTable->rowCount();
     myTable->insertRow( aRow );
 
+    for( int i=0; i<COLUMNS_COUNT; i++ )
+    {
+      myTable->setItem( aRow, i, new QTableWidgetItem() );
+    }
+
     // Set default type (=> generate unique type name) and coefficient
     //...