waynew
1st August 2010, 00:18
I have a QSqlTableModel and a QTableView.
Trying to make just one column not editable.
Found several examples in previous posts, but nothing is making sense to me as how to accomplish this in my code.
The signal/slot for when a cell is clicked is working ok.
Here is what I have so far:
void MainWindow::checkEditable(QModelIndex index) {
qDebug() << "view has been clicked!"; // good so far
int col = index.column();
int row = index.row();
qDebug() << "clicked column is " << col; // got the column ok
if (col != 0) { // it should be ok to edit
// now what???
}
}
Am I on the wrong track or is this simple to finish?
Trying to make just one column not editable.
Found several examples in previous posts, but nothing is making sense to me as how to accomplish this in my code.
The signal/slot for when a cell is clicked is working ok.
Here is what I have so far:
void MainWindow::checkEditable(QModelIndex index) {
qDebug() << "view has been clicked!"; // good so far
int col = index.column();
int row = index.row();
qDebug() << "clicked column is " << col; // got the column ok
if (col != 0) { // it should be ok to edit
// now what???
}
}
Am I on the wrong track or is this simple to finish?