From f5614783e87ef0075585fde81150afff85e92c77 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 18 Nov 2015 08:07:10 +0300 Subject: [PATCH] refs #717: crash after Strickler coefficient addition --- src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx index 85897ffe..f98053b3 100644 --- a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx @@ -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; isetItem( aRow, i, new QTableWidgetItem() ); + } + // Set default type (=> generate unique type name) and coefficient //... -- 2.39.2