<br><font size=2 face="sans-serif">Mark,</font><br><br><font size=2 face="sans-serif">Thanks for your suggestion. </font><br><br><font size=2 face="sans-serif">Problem solved by specifying both <b>self.model</b>and <b>self.proxy</b></font><br><br><font size=2 face="sans-serif">Thanks again,</font><br><font size=2 face="sans-serif">Bernard.</font><br><br><br><br><br><br><tt><font size=2>Hi Bernard,<br><br>On Tue, 3 Aug 2010 08:09:25 -0400<br>"Bernard Van Der Stichele" <Bernard_VanDerStichele@otpp.com>
wrote:<br><br>> A while back, I had asked the group how I could implement a numeical<br>> sort on a TableWidget.<br>> Someone kindly showed me how to implement a model, associated with
a <br>> TableView. The sample code was posted here: <br>> </font></tt><a href=http://diotavelli.net/PyQtWiki/Sorting%20numbers%20in%20columns><tt><font size=2>http://diotavelli.net/PyQtWiki/Sorting%20numbers%20in%20columns</font></tt></a><tt><font size=2><br>>  <br>> I'm having problems implementing this in my app. In this simple<br>> example, I use Qt Designer to create a MainForm containing a<br>> TableView (gridView), a LineEdit (queryBox) and a PushButton<br>> (runQueryBtn). The designer files (.ui and ui_xxx.py) generated<br>> defines the TableView in a couple of lines - I have not used the<br>> Designer to change any of the default object properties.<br>>  <br>> The problem I have is that the TableView remains blank. I do not <br>> understand what I'm missing, as I tried to follow the same workflow<br>> as provided by the code linked-to above..<br>> The code works, in that the data I want to display is retrieved from<br>> a database and I receive no runtime warnings or errors.<br>>  <br>> Any help is greatly appreciated... this is probably one of those<br>> simple newbie errors.<br>>  <br>> My application shell is as follows:<br>[snip]<br><br>I've only had the chance for a quick glimpse at your code.<br><br>One thought would be to replace<br><br>    model<br><br>with<br><br>    self.model<br><br>because I think it might be getting garbage collected. (Or give the<br>model a parent.)<br><br>BTW You might be able to avoid a proxy altogether since you're using<br>standard items: look up QStandardItemModel.sortRole() &<br>QStandardItemModel.setSortRole().<br><br>[snip]<br><br><br><br>-- <br>Mark Summerfield, Qtrac Ltd, </font></tt><a href=www.qtrac.eu><tt><font size=2>www.qtrac.eu</font></tt></a><tt><font size=2><br>    C++, Python, Qt, PyQt - training and consultancy<br>        "Advanced Qt Programming" - ISBN
0321635906<br>            </font></tt><a href=http://www.qtrac.eu/aqpbook.html><tt><font size=2>http://www.qtrac.eu/aqpbook.html</font></tt></a><tt><font size=2><br><br></font></tt><br><BR>
<BR>
<BR>
CONFIDENTIALITY WARNING<BR>
This e-mail message, including any attachment(s), is confidential. If we sent this communication to you in error, please do not disclose it to anyone else or use the information in it. Please notify the sender of the transmission error and then delete our communication from your system without printing, copying or forwarding it.  Thank you for your co-operation.<BR>
<BR>
AVERTISSEMENT CONCERNANT LE CARACTERE CONFIDENTIEL DE L'INFORMATION<BR>
<BR>
Le present courriel, y compris toute piece qui y est jointe, est confidentiel. Si nous vous avons envoye cette communication par erreur, nous vous prions de ne la divulguer a personne ni a utiliser l’information qu’elle contient. Veuillez informer l’expediteur de l’erreur de transmission et effacer ensuite notre communication de votre systeme sans l’imprimer, ni la copier ni la retransmettre. Nous vous remercions de votre cooperation.<BR>
<BR>
<BR>