Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 5.12 QListView text not showing when using setUniformItemSizes



  • Hello I'm having an issue in Qt 5.12 using QListView with QFileSystemModel. When I use setUniformItemSizes(true) on the listview some items don't show the text label but in others it looks like it is aligned outside of the item and clipped.

    The result in Qt 5.12:

    image 5.12

    The result in Qt 5.6:

    image 5.6

    Edit:
    I'm using Windows 8,1 64 bits.

    Code:

    #include <QApplication>
    #include <QFileSystemModel>
    #include <QListView>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        QFileSystemModel *filesModel = new QFileSystemModel();
        filesModel->setRootPath("");
    
        QListView *listView = new QListView();
        listView->setUniformItemSizes(true);
        listView->setModel(filesModel);
        listView->setRootIndex(filesModel->index("C:/files"));
        listView->setViewMode(QListView::IconMode);
        listView->resize(800,600);
        listView->show();
    
        return a.exec();
    }
    

  • Lifetime Qt Champion

    Hi,

    Can you provide a minimal compilable example reproducing that behaviour ?

    What OS are you running ?



  • thank you, I added the additional information


  • Qt Champions 2019

    Unfortunately this is a bug introduced in 5.12, hope to get it fixed until 5.12.2: https://bugreports.qt.io/browse/QTBUG-72869


Log in to reply