sOuSiX
20th April 2011, 16:57
Hello all,
I'm searching for a "generic" solution to store checkbox status in a QSqlTableModel. In fact, I have a custom QSqlTableModel with a QSet<QPersistenModelIndex> to store all modelindex where the box are checked.
Of course i have redefined data(), setData(), flag(), removeRows().
--> My simple implementation is here on github :
sqltablemodelcheckable.cpp (https://github.com/sOuSiX/QDM68/blob/master/src/sqltablemodelcheckable.cpp)
sqltablemodelcheckable.h (https://github.com/sOuSiX/QDM68/blob/master/src/sqltablemodelcheckable.h)
The problem is : when I call "SubmitAll()", all my QPersistenModelIndex are automatically set to invalid. Are the modelindex that they refers are deleted, then recreated or something like that (???)
Does someone know why ? Or can indicate me another solution.
Thanks a lot.
I'm searching for a "generic" solution to store checkbox status in a QSqlTableModel. In fact, I have a custom QSqlTableModel with a QSet<QPersistenModelIndex> to store all modelindex where the box are checked.
Of course i have redefined data(), setData(), flag(), removeRows().
--> My simple implementation is here on github :
sqltablemodelcheckable.cpp (https://github.com/sOuSiX/QDM68/blob/master/src/sqltablemodelcheckable.cpp)
sqltablemodelcheckable.h (https://github.com/sOuSiX/QDM68/blob/master/src/sqltablemodelcheckable.h)
The problem is : when I call "SubmitAll()", all my QPersistenModelIndex are automatically set to invalid. Are the modelindex that they refers are deleted, then recreated or something like that (???)
Does someone know why ? Or can indicate me another solution.
Thanks a lot.