Well...I am doing something wrong?
This is the table constructor...
.
.
.
pItemTorque->setTextAlignment(Qt::AlignHCenter);
setItem(ROW_TORQUE, SECOND_COLUMN, pItemTorque);
.
.
.
.
.
.
pItemTorque = new QTableWidgetItem;
pItemTorque->setTextAlignment(Qt::AlignHCenter);
setItem(ROW_TORQUE, SECOND_COLUMN, pItemTorque);
.
.
.
To copy to clipboard, switch view to plain text mode
...and this is the method that is called to populate the cell...
void PSetConfigurationTable
::setTorque(QString torque
) {
if(torque.isEmpty())
{
torqueItem->setFlags(Qt::ItemIsSelectable);
}
else
{
torqueItem->setFlags(Qt::ItemIsEditable);
}
torqueItem
->setData
(Qt
::EditRole,
QVariant(torque
));
}
void PSetConfigurationTable::setTorque(QString torque)
{
QTableWidgetItem *torqueItem = item( 0, 1 );
if(torque.isEmpty())
{
torqueItem->setFlags(Qt::ItemIsSelectable);
}
else
{
torqueItem->setFlags(Qt::ItemIsEditable);
}
torqueItem->setData(Qt::EditRole, QVariant(torque));
}
To copy to clipboard, switch view to plain text mode
It is ok if the cell is editable if a value is set. If a value is not set the cell is just selectable...and if a value comes along the setFlags(Qt::ItemIsEditable) does not work...in fact the app. goes down. What am i doing wrong?
Bookmarks