Better way to do table not editable

--HG--
branch : develop
This commit is contained in:
Valentina Zhuravska 2016-01-13 11:22:39 +02:00
parent 48bf54dfd9
commit bc1664a275

View File

@ -169,6 +169,7 @@ void DialogHistory::FillTable()
QTableWidgetItem *item = new QTableWidgetItem(QString()); QTableWidgetItem *item = new QTableWidgetItem(QString());
item->setTextAlignment(Qt::AlignHCenter); item->setTextAlignment(Qt::AlignHCenter);
item->setData(Qt::UserRole, tool.getId()); item->setData(Qt::UserRole, tool.getId());
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
ui->tableWidget->setItem(currentRow, 0, item); ui->tableWidget->setItem(currentRow, 0, item);
} }
@ -177,9 +178,6 @@ void DialogHistory::FillTable()
item->setFlags(item->flags() ^ Qt::ItemIsEditable); item->setFlags(item->flags() ^ Qt::ItemIsEditable);
ui->tableWidget->setItem(currentRow, 1, item); ui->tableWidget->setItem(currentRow, 1, item);
++count; ++count;
item = ui->tableWidget->item(currentRow, 0);
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
} }
} }
ui->tableWidget->setRowCount(count);//Real row count ui->tableWidget->setRowCount(count);//Real row count