QTableView items was draw differently in Qt/PyQt 5.8 and 5.9



  • They say it is a Qt bug, I don't know if it is true

    It happened when I use the following code on win7 32bit,

    import sys
    from PyQt5.QtCore import *
    from PyQt5.QtGui import *
    from PyQt5.QtWidgets import *
    
    
    if __name__ == '__main__':
    
        app = QApplication(sys.argv)
        # ui = QMainWindow()
    
        path = r'D:\BaiduYunDownload\untitled'
        model = QFileSystemModel()
        model.setRootPath(path)
    
        table = QTableView()
        table.setModel(model)
        table.setRootIndex(model.index(path))
    
        # ui.setCentralWidget(table)
        table.resize(800, 600)
        table.show()
    
        viewOptions = table.viewOptions()
        print(table.wordWrap(),
              int(viewOptions.textElideMode),
              int(viewOptions.decorationAlignment),
              int(viewOptions.displayAlignment),
              int(viewOptions.features))
    
        app.exec_()
    

    there is only one file with the long name(for test):
    A directory model that displays the contents of a default directory is usually constructed with a parent object.txt
    in dir D:\BaiduYunDownload\untitled

    In PyQt 5.8 (installed via pip3 install pyqt5==5.8)
    enter image description here

    In PyQt 5.9.1 (installed via pip3 install pyqt5==5.9)
    enter image description here

    I wonder why the QTableView item in the Name column was draw differently ? I checked with the following property in the code, all returned the same value in both version of PyQt .

    print(table.wordWrap(),
    int(viewOptions.textElideMode),
    int(viewOptions.decorationAlignment),
    int(viewOptions.displayAlignment),
    int(viewOptions.features))

  • Lifetime Qt Champion

    Hi,

    Based on the report linked, looks like it's indeed the case.


  • Lifetime Qt Champion

    Can you check with Qt 5.10 ?



  • @SGaist I will when the PyQt binding for Qt 5.10 is available


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.