[PyKDE] Model-View application: view not updated
Sibylle Koczian
Sibylle.Koczian at t-online.de
Sun Dec 17 12:22:22 GMT 2006
Am Samstag, den 16.12.2006, 19:45 +0100 schrieb Andreas Pakulat:
> Ok, thanks now I do understand your problem. Unfortunately I can't
> reproduce it here with your example application. After editing two cells
> and clicking Cancel the view is updated to reflect the original data and
> I get
>
> TestModel.setResultset called
> fillTable called
> TestModel.setResultset called
> Signal modelReset empfangen
>
> In the console, so its clearly working. What version of Qt4 are you
> using? (I'm on 4.2.x here, where x is IIRC something around 2)
>
Qt4: 4.2.0-1ubuntu6 (installed packages: libqt4-core, -def, -gui,
-qt3support, -sql, qt4-designer, qt4-doc - possibly something lacking?)
PyQt4: 4.0.1-1ubuntu1 (installed packages: pyqt4-dev-tools, python-qt4,
-qt4-dev, -doc, -sql)
> If you can't change your Qt version, try emitting the dataChanged
> Signal with the top-left and bottom-right QModelIndex.
>
That has helped: I replaced the "self.reset()" at the end of
setResultset() with the dataChanged Signal, now I get the original data
back without changing focus or doing other tricks. It's not very
beautiful, but it works for the moment.
BTW, making this change I saw that the rowCount() and columnCount()
methods should get "parent=None" as default argument.
Regarding a newer Qt and/or PyQt version, I'm thinking about changing my
linux distribution anyway, but I don't yet know what I really need.
> > BTW: Did you look at the
> > > ready-made models for accessing SQL databases in Qt4?
> >
> > I didn't understand how to get the SQL support for Firebird.
>
> Load the driver? I haven't compiled firebird support here, but it should
> be as easy as that.
>
> > Especially using Ubuntu which doesn't put Firebird in the standard place Qt4 expects it in.
>
> Well, if firebird libs and includes are in different directories use the
> -I and -L flags to Qt4's configure (or use the system-provided Qt4 if it
> includes firebird support - which it should). For example I run
> configure -I/usr/include/mysql -I/usr/include/postgresql
> to get the mysql and postgresql driver built (am using plain Debian
> here)
>
The system provided Qt4 doesn't include Firebird support, as far as I
can see (Synaptic says "PostgreSQL, MySQL, SQLite"). Qt4's configure:
that would be the configure step as in "configure / make / make
install", right?
At the moment I'm playing with a SQLite database containing part of my
data. So I could try out the SQL models with this. The "cachedtable"
example should be a good start.
Thank you for your help,
Sibylle
--
Dr. Sibylle Koczian
Fasanenstraße 12
D-82293 Mittelstetten
More information about the PyQt
mailing list