You don't need to worry about the abstract model just to get data into a table. I believe it's simplest form is just creating a table item and inserting it in the table.<div><br></div><div>For a string (using unicode):</div>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
item = QtGui.QTableWidgetItem( unicode(data))<br></blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
table.setItem(rowCount, colCount, item )<br></blockquote><div><div><br></div><div><br></div><div>For data:</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
item= QtGui.QTableWidgetItem( 0 ) </blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
item.setData( 0, QtCore.QVariant( data )</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
table.setItem(rowCount, colCount, item )</blockquote><div><br></div><div><br></div><div>I'm new to this myself, but this is the way that I have it working.</div><div><br></div><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 1:07 PM, Brian Makin <span dir="ltr"><<a href="mailto:merimus@gmail.com">merimus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I need to create a table with string and number fields. I'm having a bit of problem getting this to work. What is the correct way to do this?<br>
<br>
It doesn't look like TableModel handles numbers so do I need to subclass abstract table model et al?<br>
<br>
Are there any handy examples of this (including sorting of the columns)?<br>
<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br></div>