[PyQt] Re: Re: Populate Model data in a separate thread (Demetrius
Cassidy)
Edwin Marshall
aspidites at inbox.com
Mon Apr 27 22:24:39 BST 2009
First of all, I am subscribed to the digest version of the mailing list, so I'm not 100% sure how to reply to specific topics, sorry.
Demetrius, my model currently contains approx. 1,800 records, and will eventually contain about 4,400 records, each with 11 columns, one of which displays a pixmap.
In my model's __init__() method, I load the data from a sqlite table using python's native sqlite3 API (QTSql was way too slow, which is why I can't use QSQLRelationalTableModel). In the rowCount() method, I return the number of records in my database table, and in the columnCount() method I return the number of columns. The data method simply maps an index.row() and index.column() to the same row and column in the database.
I would like to defer the loading of the model's data to a thread so that the user doesn't experience delay when he opens my program. Ideally, the program's window would immediately be shown with an empty table view, and once my model was done getting it's data, would populate the table view.
If I understood you correctly, you are suggesting that I implement my model as an editable one, then have a method that is run in a thread that populates it using its setData() and insertRows() methods? While I think I have a grasp of writing editable models, I'm not sure I understand how to connect signals from a qthread to that of my model. Could you elaborate, please?
Thanks in advance,
Edwin Marshall
> -----Original Message-----
> From: pyqt-request at riverbankcomputing.com
> Sent: Mon, 27 Apr 2009 12:00:12 +0100
> To: pyqt at riverbankcomputing.com
> Subject: PyQt Digest, Vol 57, Issue 53
>
> Send PyQt mailing list submissions to
> pyqt at riverbankcomputing.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> or, via email, send a message with subject or body 'help' to
> pyqt-request at riverbankcomputing.com
>
> You can reach the person managing the list at
> pyqt-owner at riverbankcomputing.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PyQt digest..."
> Today's Topics:
>
> 1. pyrcc4 regression in snapshot-0425? (Grissiom)
> 2. resource name problem in ui_* (Robert Norman)
> 3. Re: Searching for a very small scprit using CLIPBOARD
> (Aron Bierbaum)
> 4. Re: re[PyQt] source name problem in ui_* (Demetrius Cassidy)
> 5. Re: RuntimeError: underlying C/C++ object has been deleted
> (Alexandr N Zamaraev)
> 6. Re: RuntimeError: underlying C/C++ object has been deleted
> (Demetrius Cassidy)
> 7. Re: Populate Model data in a separate thread (Demetrius Cassidy)
> 8. Re: RuntimeError: underlying C/C++ object has been deleted
> (Alexandr N Zamaraev)
> _______________________________________________
> PyQt mailing list
> PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
____________________________________________________________
Receive Notifications of Incoming Messages
Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!
More information about the PyQt
mailing list