Question on subclassing QSqlTableModel
It seems that subclassing QSqlTableModel would be a good way to set some columns as Editable and others not, by reimplementing QSqlTableModel::data to control Qt::EditRole (is this a good idea?). In looking at the source I see that most methods in QSqlTableModel start with a line that is either "Q_D(QSqlTableModel);" or "Q_D(const QSqlTableModel);"; some start with "Q_Q(QSqlTableModel);", some don't have such a thing.
I cannot find documentation on this. What are they? If I subclass QSqlTableModel do I need to include them in my reimplementations of methods? If I create a new method how do I determine if I need one of these?
Thanks
Re: Question on subclassing QSqlTableModel
Actually, I guess I need to reimplement "flags(const QModelIndex &index) const"
Re: Question on subclassing QSqlTableModel
Also - in methods involving the Editor and Editor Factory there is a class pointer variable "d", I cannot find out what this is and where it is initialized.
Re: Question on subclassing QSqlTableModel
"d" and Q_D or Q_Q is all about pimpl. A good start in this topic you can find here: http://zchydem.enume.net/?p=504
Re: Question on subclassing QSqlTableModel
I agree, the QSqlTableModel code is confusing.
There is a very good example in the docs that goes about this the other way round: make columns of a read-only model (QSqlQueryModel) editable.
Also regarding your post on the newbie forum about delegates, the example demonstrates how to format columns by reimplementing "QSqlQueryModel::data ( const QModelIndex & item, int role = Qt:: DisplayRole ) const"