Python PyQt4使用小部件移动QTableWidget行

Python PyQt4使用小部件移动QTableWidget行,python,pyqt,pyqt4,Python,Pyqt,Pyqt4,我的PyQt4应用程序中有以下方法。r2是要移动的行数,r1是应该移动的位置。澄清一下:表中填充的是cellWidgets,而不是widgetItems def move_row(self, r1, r2): tt = self.tableWidget tt.insertRow(r1) for c in range(tt.columnCount()): tt.setCellWidget(r1, c, tt.cellWidget(r2 + 1, c))

我的PyQt4应用程序中有以下方法。r2是要移动的行数,r1是应该移动的位置。澄清一下:表中填充的是cellWidgets,而不是widgetItems

def move_row(self, r1, r2):
    tt = self.tableWidget
    tt.insertRow(r1)
    for c in range(tt.columnCount()):
        tt.setCellWidget(r1, c, tt.cellWidget(r2 + 1, c))
    tt.removeRow(r2 + 1) # <--- ???
def move_行(self、r1、r2):
tt=self.tableWidget
tt.插入行(r1)
对于范围内的c(tt.columnCount()):
tt.setCellWidget(r1,c,tt.cellWidget(r2+1,c))

tt.removeRow(r2+1)#我最终完成了小部件值的复制。

我最终完成了小部件值的复制