From: vsv Date: Wed, 28 Dec 2016 10:07:49 +0000 (+0300) Subject: Issue #1945: fix of updating of a table on editing X-Git-Tag: V_2.7.0~351^2~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a83f437021e036663942c660928a5a3f449ccd8c;p=modules%2Fshaper.git Issue #1945: fix of updating of a table on editing --- diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index ebec37630..8418132a3 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -263,8 +263,10 @@ void CollectionPlugin_WidgetField::appendStepControls() } if (aColWidth.length() > 0) { - for (int i = 0; i < aDataTbl->columnCount(); i++) + for (int i = 0; i < aDataTbl->columnCount(); i++) { + if (i < aColWidth.size()) aDataTbl->setColumnWidth(i, aColWidth.at(i)); + } } aStepLayout->addWidget(aDataTbl, 1, 0, 1, 2); connect(aDataTbl, SIGNAL(cellChanged(int, int)), SLOT(onTableEdited(int, int))); @@ -548,6 +550,8 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() QTableWidget* aTable = myDataTblList.at(i); isBlocked = aTable->blockSignals(true); aTable->setRowCount(aRows); + aTable->setColumnCount(aCols + 1); + updateHeaders(aTable); for (int j = 0; j < aCols + 1; j++) { for (int k = 0; k < aRows; k++) { aItem = aTable->item(k, j); @@ -575,8 +579,10 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() } } // Restore columns width - for (int i = 0; i < aTable->columnCount(); i++) - aTable->setColumnWidth(i, aColWidth.at(i)); + for (int i = 0; i < aTable->columnCount(); i++) { + if (i < aColWidth.size()) + aTable->setColumnWidth(i, aColWidth.at(i)); + } aTable->blockSignals(isBlocked); }