当前位置: 首页>>代码示例>>Python>>正文


Python QTableWidgetItem.setText方法代码示例

本文整理汇总了Python中PyQt4.Qt.QTableWidgetItem.setText方法的典型用法代码示例。如果您正苦于以下问题:Python QTableWidgetItem.setText方法的具体用法?Python QTableWidgetItem.setText怎么用?Python QTableWidgetItem.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QTableWidgetItem的用法示例。


在下文中一共展示了QTableWidgetItem.setText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate_tbl_helper

# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setText [as 别名]
 def populate_tbl_helper(hsgui, tbl, col_headers, col_editable, row_list, row2_data_tup ):
     #tbl = main_skel.chip_TBL
     hheader = tbl.horizontalHeader()
     sort_col = hheader.sortIndicatorSection()
     sort_ord = hheader.sortIndicatorOrder()
     tbl.sortByColumn(0, Qt.AscendingOrder) # Basic Sorting
     prevBlockSignals = tbl.blockSignals(True)
     tbl.clear()
     tbl.setColumnCount(len(col_headers))
     tbl.setRowCount(len(row_list))
     tbl.verticalHeader().hide()
     tbl.setHorizontalHeaderLabels(col_headers)
     tbl.setSelectionMode( QAbstractItemView.SingleSelection )
     tbl.setSelectionBehavior( QAbstractItemView.SelectRows)
     tbl.setSortingEnabled(False)
     for row in iter(row_list):
         data_tup = row2_data_tup[row]
         for col, data in enumerate(data_tup):
             item = QTableWidgetItem()
             try:
                 int_data = int(data)
                 item.setData(Qt.DisplayRole, int_data)
             except ValueError: # for strings
                 item.setText(str(data))
             except TypeError: #for lists
                 item.setText(str(data))
             item.setTextAlignment(Qt.AlignHCenter)
             if col_editable[col]: item.setFlags(item.flags() | Qt.ItemIsEditable)
             else: item.setFlags(item.flags() ^ Qt.ItemIsEditable)
             tbl.setItem(row, col, item)
     tbl.setSortingEnabled(True)
     tbl.sortByColumn(sort_col,sort_ord) # Move back to old sorting
     tbl.show()
     tbl.blockSignals(prevBlockSignals)
开发者ID:Erotemic,项目名称:hotspotter,代码行数:36,代码来源:MainWindow.py

示例2: setText

# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setText [as 别名]
 def setText(self, txt):
     self.current_value = txt
     QTableWidgetItem.setText(txt)
开发者ID:Eksmo,项目名称:calibre,代码行数:5,代码来源:tag_list_editor.py

示例3: residuals2

# 需要导入模块: from PyQt4.Qt import QTableWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTableWidgetItem import setText [as 别名]
    def residuals2(self):
        self.AObs=self.posterioriValue*self.A*(self.A.T*self.P*self.A)**-1*self.A.T
        self.cofactorM=self.A*(self.A.T*self.P*self.A)**-1*self.A.T
        self.AResObs=self.posterioriValue*(self.P**-1 - self.A*(self.A.T*self.P*self.A)**-1*self.A.T)
#         print (self.A.T*self.P*self.A)**-1
#         print self.posterioriValue
#         print self.posterioriValue*(self.A.T*self.P*self.A)**-1
        self.cofactorAObs.clear()
        self.cofactorZ.clear()
        self.residA=OrderedDict()
        self.residARe=OrderedDict()
#         print self.cofactorM   
        count = 0
        for i,j in self.obs.iteritems():
            for k,l in j.iteritems():
                count+=1
        self.obsCount=count
        self.cofactorAObs.setColumnCount(count)
        self.cofactorAObs.setRowCount(count)
        self.cofactorZ.setColumnCount(count)
        self.cofactorZ.setRowCount(count)
        for i in range (count):
            for j in range (count):
                temp=QTableWidgetItem()
                temp.setText(str(self.cofactorM[i,j]))
                self.cofactorAObs.setItem(i,j,temp)
        for i in range (count):
            for j in range (count):
                temp=QTableWidgetItem()
                temp.setText(str(self.AResObs[i,j]))
                self.cofactorZ.setItem(i,j,temp)
        i=0
        for x,sta in self.obs.iteritems():
            for tn,tar in sta.iteritems():

                name=x
    #             name=x[0:-2]
                if not self.residA.has_key(x+tn):
                    self.residA[x+tn]=[None]
                if not self.residARe.has_key(x+tn):
                    self.residARe[x+tn]=[None]
                
    
                self.residA[x+tn][0]=sqrt(self.AObs[i,i])
                self.residARe[x+tn][0]=sqrt(self.AResObs[i,i])
                i+=1
#         print self.residA
#         print self.residARe
        for x,sta in self.obs.iteritems():
           for tn,target in sta.iteritems(): 
                name=x+tn
                item1 = QTreeWidgetItem(self.stdDevAtree)
                item2 = QTreeWidgetItem(self.stdDevObsTree)
                if tn[-1]=="D":
                    item1.setText(0, "Direction from"+ x +"to :"+tn[0:-2])
                    item2.setText(0,"Direction from"+ x+"to :"+tn[0:-2])
                elif tn[-1]=="d":
                    item1.setText(0, "Distance from"+ x+"to :"+tn[0:-2])
                    item2.setText(0,"Distance from"+ x+"to :"+tn[0:-2])
                    
                    
                    
                item1.setText(1, str(round(float(self.residA[name][0]),3)))
                item2.setText(1, str(round(float(self.residARe[name][0]),3)))
开发者ID:CraigNielsen,项目名称:LeastSquaresGui,代码行数:66,代码来源:main1.py


注:本文中的PyQt4.Qt.QTableWidgetItem.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。