Perfect....setting the flags did the job.  I have a very simple subclass
that overrides flags:

    def flags(self, index):
        return Qt.ItemIsSelectable | Qt.ItemIsEnabled

Thank you!
BZ

On Mon, Aug 24, 2009 at 2:56 AM, Sibylle Koczian <
sibylle.kocz...@t-online.de> wrote:

>
> "Brian Zambrano" <bri...@gmail.com> schrieb:
>
> Is there a way to create a read-only QSqlRelationalTableModel?
>
> From the docs, I'm thinking that I need to create my own subclass of
> QSqlQueryModel which follow the relationships that I need.
>
> Thanks,
> BZ
>
> I think you could subclass QSqlRelationalTableModel and just override
> setData(). It should always return False. And/or override flags():
>
> def flags(self, index):
>     flags = QtSql.QSqlRelationalTableModel.flags(self, index)
>     flags ~= QtCore.Qt.ItemIsEditable
>     return flags
>
> But all this is untested! Just the opposite from making a QSqlQueryModel
> editable.
>
> On the other hand a QSqlQueryModel can use every query, so I don't quite
> know why you couldn't use it as is, with all the relationships built into
> the query?
>
> HTH
> Sibylle
>
> --
> Dr. Sibylle Koczian
>
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to