2013-10-30 72 views

回答

2

你幾乎可以複製粘貼C++代碼。這裏是pyqt的實現:

class YourSystemModel(QtGui.QFileSystemModel): 

    def columnCount(self, parent = QtCore.QModelIndex()): 
     return super(YourSystemModel, self).columnCount()+1 

    def data(self, index, role): 
     if index.column() == self.columnCount() - 1: 
      if role == QtCore.Qt.DisplayRole: 
       return QtCore.QString("YourText") 
      if role == QtCore.Qt.TextAlignmentRole: 
       return QtCore.Qt.AlignHCenter 

     return super(YourSystemModel, self).data(index, role)