Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53855 > unrolled thread

Logical error in filling QTableWidget and filling all of nodes

Started byMohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>
First post2013-09-09 09:45 +0430
Last post2013-09-09 09:45 +0430
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Logical error in filling QTableWidget and filling all of nodes Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-09-09 09:45 +0430

#53855 — Logical error in filling QTableWidget and filling all of nodes

FromMohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>
Date2013-09-09 09:45 +0430
SubjectLogical error in filling QTableWidget and filling all of nodes
Message-ID<mailman.163.1378703734.5461.python-list@python.org>
Dear All,

I have the following code (PyQt):

/////////////////
searchFrameObject.tableWidget.setRowCount(rowCounter)
searchFrameObject.tableWidget.setColumnCount(5)

for row in range(rowCounter):
    for column in range(5):
        for result in query:

            item = QtGui.QTableWidgetItem(_fromUtf8(result.name))
            item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
            searchFrameObject.tableWidget.setItem(row,column,item)

            #item = QtGui.QTableWidgetItem(String(result.bought_price))
            #item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
            #searchFrameObject.tableWidget.setItem(row,column+1,item)

            #item = QtGui.QTableWidgetItem(result.bought_date)
            #item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
            #searchFrameObject.tableWidget.setItem(row,column+2,item)

            item = QtGui.QTableWidgetItem(result.stock)
            item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
            searchFrameObject.tableWidget.setItem(row,column+3,item)

            item = QtGui.QTableWidgetItem(result.minimum_bound)
            item.setFlags(item.flags() ^ QtCore.Qt.ItemIsEnabled)
            searchFrameObject.tableWidget.setItem(row,column+4,item)
////////////////

When i search in DB, i print result.name or print result.stock ,
everything is OK. But when i import them into QtableWidget i see just
node result.name addeed to widgets. (all of nodes filled from
result.name)

My Question is , How i fill rows and columns with my fields?


Yours,
Mohsen

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web