I got 15
I try to
Qt Code:
tableView->insertColumn(16);To copy to clipboard, switch view to plain text mode
But notting changes
I got 15
I try to
Qt Code:
tableView->insertColumn(16);To copy to clipboard, switch view to plain text mode
But notting changes
So trying to insert something into the 17th column probably shouldn't have any effect, should it?
You can't add columns to sql models just like that.I try to
Qt Code:
tableView->insertColumn(16);To copy to clipboard, switch view to plain text mode
But notting changes
I think what you really want is to use Qt::CheckStateRole. That's only a teaser - how to use it is left as an exercise to you.
I did it with
Qt::CheckStateRole
But the problem is check box is not editable...
I do it like
Qt Code:
Q_OBJECT public: ........ }; if (index.column() == aColWithCheckbox) flags |= Qt::ItemIsUserCheckable; else flags |= Qt::ItemIsEditable; return flags; } if (role == Qt::CheckStateRole && index.column() == aColWithCheckbox) else return value; }To copy to clipboard, switch view to plain text mode
But as I have told you I could not check the qcheckbox
do I missed anything?
I have writen the setData didnt paste
my code is exactly like this
Qt Code:
if (index.column() == 16) flags |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable; return flags; } { if (role == Qt::CheckStateRole && index.column() == 16) return value; } if(role==Qt::CheckStateRole) }To copy to clipboard, switch view to plain text mode
The check box on the table is still not editable, I can not check the qcheckbox...
One time you are using QSqlQueryModel as your base class and the other time you are using QSqlTableModel. So which one is it?
Sorry
QSqlTableModel it should be, working right now sorry for the delay and time, but right now I had a problem I could not check more than 2 rows?
I was not able to check the check box, but I could do it right now, but I could not check more than 2 check box, When I press the 3rd check box, the 1st check is removed.
Bookmarks