Perfect....setting the flags did the job. I have a very simple subclass that overrides flags:<br><br> def flags(self, index):<br> return Qt.ItemIsSelectable | Qt.ItemIsEnabled<br><br>Thank you!<br>BZ<br><br><div class="gmail_quote">
On Mon, Aug 24, 2009 at 2:56 AM, Sibylle Koczian <span dir="ltr"><<a href="mailto:Sibylle.Koczian@t-online.de">Sibylle.Koczian@t-online.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="#000000" vlink="#000000" alink="#000080" marginwidth="0" marginheight="0">
<br>"Brian Zambrano" <<a href="mailto:brianz@gmail.com" target="_blank">brianz@gmail.com</a>> schrieb:
<div><div></div><div class="h5"><blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-left: 5px; padding-right: 0px; margin-left: 5px; margin-right: 0px;">
Is there a way to create a read-only
QSqlRelationalTableModel?<br><br>From the docs, I'm thinking that I need
to create my own subclass of QSqlQueryModel which follow the
relationships that I need.<br><br>Thanks,<br>BZ<br>
</blockquote>
</div></div><font size="2" face="Courier New">I think you could subclass
QSqlRelationalTableModel and just
override setData(). It should always return False. And/or override
flags():<br></font><font size="2" face="Courier New"><br>def
flags(self, index):<br> flags =
QtSql.QSqlRelationalTableModel.flags(self, index)<br>
flags ~=
QtCore.Qt.ItemIsEditable<br> return flags<br><br>But
all this
is untested! Just the opposite from making a QSqlQueryModel
editable.<br><br>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?<br><br>HTH<br>Sibylle<br><br>-- <br>Dr. Sibylle Koczian
<br></font></div>
</blockquote></div><br>