Entries in TreeView are not showing expand icon (Nor functional for expanding) after updating from Qt 5.6 to Qt 5.13



  • Hey everyone,

    Reaching out about the problem I put in the subject. An overview of my issue:

    • We have a file browser in our game Editor that pretty much displays a standard file tree hierarchy to the user (Same window hierarchy), nothing too complicated. The UI classes are structured in the following matter:

      - We have a "Browser Window" which is just a QWidget. It is defined by a .ui file.
      - The .ui file class defines a QTreeView. This view sets its model to QSortFilterProxyModel, which sets its source model to a QAbstractTableModel
      - Each entry in the QTreeView is a "FileAssetEntry", which is just a QObject
      

    After we updated Qt from 5.6 to 5.13, the top level folders that have children items stopped rendering the "expand arrow". Even double clicking is not causing any sort of expansion whatsoever. Interesting enough, running a text search filter works as expected; as in the filter knows the files are under a specific folder, but is not rendering them (The top level folders are showing, but still with the same issue). You can tell since folders that do not have the files are removed from display.

    I am not sure of what to look for, but so far I have done the following:

       - I verified that all the assets are getting added through beginInsertRows in the QAbstractTableModel.
       - I tested making the QTreeView point to the QAbstractTableModel directly to bypass the filter. The issue was still present.
       - I do not see any Qt warnings in our build logs.
    

    Again, not sure what to look for since I am not too experienced with Qt. Are there any "version update" checklist guidelines that can help? We might have missed some steps on making sure all the .ui files are still supported? Do we need to recompile the .moc files?

    Any insight is highly appreciated. Please let me know what other information I can provide to ease support on this.

    Cheers,

    Christian



  • Hey @SGaist

    So I tested one last thing that resolved the issue. Our model was inheriting from QAbstractTableModel. I changed it to inherit directly from QAbstractItemModel and that resolved the issue.

    I am very curious now to understand what was causing the problem, but I am glad is at least narrowed down to that.

    Cheers,

    Christian


  • Lifetime Qt Champion

    Hi,

    One thing you could do is to test with the current LTS release which is Qt 5.12.4.



  • Hey SGaist,

    Thanks for the recommendation. The issue is not present with Qt 5.12.4. However, we have a new tool that relies in 5.13.

    What would be the best way to figure out what the culprit is?



  • Hey @SGaist

    So I tested one last thing that resolved the issue. Our model was inheriting from QAbstractTableModel. I changed it to inherit directly from QAbstractItemModel and that resolved the issue.

    I am very curious now to understand what was causing the problem, but I am glad is at least narrowed down to that.

    Cheers,

    Christian


  • Lifetime Qt Champion

    So you were trying to render a table model in a tree view ?



  • Apparently.

    This was working before. Looking through the documentation it seems this was not the best use case for the tree view so it looks like a safe change on our side.


Log in to reply