QTableView - some cells and column headers not editable
-
Could following be a solution?
I just create a dummy row, which is completely empty and grayed out. Additionally it can't be sorted. How can I implement it? Maybe with subclassing? But where do I start? -
Sounds like a work-around hack, and not a solution. I would start to try and find out why your cells are not editable in the first place. Use a debugger to step into the code, and find out what happens...
-
Hello,
I cant locate the error. What do you mean by "use a debugger to step into the code"? How can I watch the changes made in tableview using a debugger?
Don't know what to do now. It's very strange that only the first row is affected.Edit: Which part of the code may be interesting regarding the changes in tableview?
-
Just set a breakpoint in the model you use at one or more appropriate points (the data() method comes to mind), and run using a debugger (F5 when using QtCreator). It might also help if you create a minimum but compilable example that shows the problem and that you offer for download, so others can try to re-produce the problem.
-
Where can I upload the minimized project?
-
Where ever you like. I usually use my public Dropbox folder when I upload stuff for this forum, but you may also use any other service you fancy. Qt DevNet does not provide an uploading service itself.
-
I created a minimized project:
http://www.sendspace.com/file/sgb6mkEdit: Just put it in /Qt/Sql example folder
-
After creating a completely new database with sqlite3 command line tool with new tables etc. using sqlitebrowser the shock: same error! I don't know why this problem occurs?!
Edit: I created a new project and tried also instead of using QSqlRelationalTableModel to use just TableModel but there's no difference. -
OK, I managed to build your example, and confirm your issue. I'll try to see if I can find what is going wrong.
-
I am completely at a loss. Even if I further simply your sample (use a QSqlQueryModel instead of a QSqlRelationalTableModel), I get the same behavior you described. Very, very strange indeed. I would have expected the flags() implementation to be the problem, but it seems that it isn't even implemented until the QAbstractItemModel.
I tried to see what flags are returned by the model for each index, and that looks fine to me. According to this code, every index should be enabled and selectable:
@void Window::getModelIndex()
{
int rows = tableView->model()->rowCount();
int columns = tableView->model()->columnCount();
for (int row(0); row<rows; ++row) {
for (int col(0); col<columns; ++col) {
QModelIndex idx = tableView->model()->index(row, col);
qDebug() << "r:" << row << "c:" << col << "valid:" << idx.isValid() << "flags:" << idx.flags();
}
}
}
@Why those cells refuse to be selected anyway is beyond me.
I think it is time to file a bug report.
-
What is the result of the bug report? How long will it take to fix that problem?
-
it depends on the problem complexity etc...
There is no time frame for such things.If you need fast responses and fixes, you need a commercial license and support. Otherwise you could also fix it and create a merge request on www.gitorious.org
-
[quote author="Psychonaut" date="1305785662"]What is the result of the bug report? How long will it take to fix that problem?[/quote]
That depends on how important is it deemed to be (by the maintainer of that piece of code), other priorities, and how complex the issue is, as well as how well documented and easy to reproduce the issue is. That is: there is no fixed time frame. Some bugs are never solved, some the same day.