Fix broken deletion of increment.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-04 17:35:57 +03:00
parent 7c52bf240f
commit c11e5d39dc
2 changed files with 16 additions and 6 deletions

View File

@ -355,6 +355,7 @@ void DialogIncrements::FullUpdateFromFile()
}
ui->tableWidgetMeasurements->clearContents();
FillMeasurements();
ui->tableWidgetMeasurements->horizontalHeader()->setStretchLastSection(true);
if (qApp->patternType() == MeasurementsType::Individual)
{
connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged);
@ -362,6 +363,7 @@ void DialogIncrements::FullUpdateFromFile()
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
ui->tableWidgetIncrement->clearContents();
ui->tableWidgetIncrement->horizontalHeader()->setStretchLastSection(true);
FillIncrements();
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged);
@ -590,22 +592,27 @@ void DialogIncrements::clickedToolButtonRemove()
{
disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::IncrementChanged);
QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem();
qint32 row = item->row();
QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
data->RemoveIncrement(itemName->text());
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
QDomElement domElement = doc->elementById(QString().setNum(id));
if (domElement.isElement())
{
QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
list.at(0).removeChild(domElement);
}
ui->tableWidgetIncrement->removeRow(row);
if (ui->tableWidgetIncrement->rowCount() == 0)
{
ui->toolButtonRemove->setEnabled(false);
}
connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this,
&DialogIncrements::IncrementChanged);
emit haveLiteChange();

View File

@ -39,7 +39,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabStandard">
<property name="sizePolicy">
@ -108,7 +108,7 @@
</size>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="pagePersonalInformation">
<property name="enabled">
@ -398,10 +398,10 @@
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>95</number>
<number>120</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>17</number>
<number>70</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
@ -416,7 +416,10 @@
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>20</number>
<number>25</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>8</number>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>