On 2008-01-09, Sibylle Koczian wrote: > Hello, > > the assetmanager.pyw example doesn't seem to work correctly, or I'm using > it wrongly: > > - The logs view always shows one empty line after the records > belonging to the selected asset. Why? When I try to write such a > master-detail dialog myself, using the asset manager as a model, I get > even more empty lines, and their number changes. Should I try to > shrink it to a minimal example still showing the problem, or is this a > known issue? > > - After leaving the application I get the error message > "QSqlDatabasePrivate::removeDatabase: connection > 'qt_sql_default_connection' is still in use, all queries will cease to > work." I have had this message in my own programs - it went away, > when I didn't define a "main" funktion, but put its content directly > under "if __name__ == '__main__':". But I never understood why this > should be so.
Hi Koczian, I had experienced both these problems when developing the application, but neither occurred when I tested on Linux & Windows at the time the book was published. Since then I've upgraded to PyQt 4.3.1/Qt 4.3.2, and now both problems are back. The too many rows bug is a problem with QTableView. When setFilter() is applied, followed by select(), the correct rows are selected and Qt knows how many rows there are (which you can verify by putting "print self.logModel.rowCount()" after the select() call). But the QTableView shows twice as many rows as are in the model, with the extra ones shown empty. This only seems to happen when setFilter() is used (which may be why the problem doesn't affect the assets table), and the underlying SQL table is not affected. So this seems to be a Qt bug---one that seems to come and go with different minor versions unfortunately! I checked the Trolltech "Task Tracker" (bug tracker) and it looks like this problem is bug 170783 which was scheduled to be fixed in Qt 4.3.2---but I'm using Qt 4.3.2 and the bug is still present. The error message is harmless, but annoying. I don't think it is due to any bug in the application, but rather a problem in PyQt regarding the lifetime of the default connection, so I'm passing the buck to Phil on this one. All I can suggest is trying to upgrade to Qt 4.3.3 and PyQt 4.3.3 and seeing if the bugs have been fixed in those versions! -- Mark Summerfield, Qtrac Ltd., www.qtrac.eu _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
