mikrocat
27th January 2016, 07:52
In my software I have a tableview with a model.
While runtime the model changes. Sometimes I want to hide columns, but after I changed the model a third time it does not work anymore.
void MonitorWindow::setColumnsHidden(bool hide){
for (int i = 0; i < myTransducermodel->columnCount(); ++i){
qDebug() << hide << i;
ui->transducerTable->setColumnHidden(i, hide);
qDebug() << "hidden?" << ui->transducerTable->isColumnHidden(i);
}
}
}
The Debug says:
true 0
hidden? false
true 1
hidden? false
true 2
hidden? false
true 3
hidden? false
...
Why is that? Do I miss something when I set a new model?
myTransducermodel->clearColumns();
....
ui->transducerTable->setModel(myTransducermodel);
void TransducerSetModel::clearColumns(){
tableHeaders.clear();
}
While runtime the model changes. Sometimes I want to hide columns, but after I changed the model a third time it does not work anymore.
void MonitorWindow::setColumnsHidden(bool hide){
for (int i = 0; i < myTransducermodel->columnCount(); ++i){
qDebug() << hide << i;
ui->transducerTable->setColumnHidden(i, hide);
qDebug() << "hidden?" << ui->transducerTable->isColumnHidden(i);
}
}
}
The Debug says:
true 0
hidden? false
true 1
hidden? false
true 2
hidden? false
true 3
hidden? false
...
Why is that? Do I miss something when I set a new model?
myTransducermodel->clearColumns();
....
ui->transducerTable->setModel(myTransducermodel);
void TransducerSetModel::clearColumns(){
tableHeaders.clear();
}