Header view when QFileSystemModel is displayed in a QTableView
-
when the contents of the QFileSystemModel is displayed in a QTableView , the alignment of the text in the first row header section is right-aligned ,while the others is left-aligned,I wonder why ? enter image description here
!http://i.stack.imgur.com/ohJ9u.jpg(pic)!
how to make the alignment of the text in each header section to be left-aligned?setDefaultSectionSize() seems doesn't work here
my code
@
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *if name == 'main':
app =QApplication(sys.argv) ui =QMainWindow() model= QFileSystemModel () model.setRootPath(QDir.currentPath()) model.sort(3) table = QTableView() #print(table.verticalHeader().defaultAlignment()) # table.verticalHeader().setDefaultAlignment(Qt.AlignRight) table.setModel(model); table.setRootIndex(model.index(QDir.currentPath())) # ui.setCentralWidget(table) ui.resize(800, 600) ui.show() app.exec_()
@