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

selectionMode property not available in TreeView 2



  • I am using the TreeView (v2) from the marketplace. I wish to set the 'selectionMode' property in the treeview but this property is not recognized.

    According to docs the TreeView inherits from BasicTableView, which contains a 'selectionMode' property.

    How can I set the selectionMode for this TreeView?



  • @ocgltd said in selectionMode property not available in TreeView 2:

    but the QtCreator help for TreeView shows the QQC1 documentation.

    That is really shitty. Contact qt for docs. This is a user forum and I don't think anyone here works for Qt. Are their docs in the build stuff for the module? Like a make docs or something?



  • @ocgltd said in selectionMode property not available in TreeView 2:

    but this property is not recognized.

    Define what this means.
    Qt Creator is often stupid and doesn't recognize things that work fine.
    Is it failing in the console or just creator being stupid?
    What is the error message when it fails?

    Never mind, you are looking at the docs for TreeView from controls 1.4. Find the docs for the one from controls 2.x. I cannot find them.



  • I think you are right. In that case, where do I set the selectionMode for the view?



  • @ocgltd I cannot find the docs. They are unavailable to me. Have you tried pressing F1 after clicking on TreeView in qml editor? They may have installed docs locally for it.



  • I'm building the QML file in QtCreator's text editor (I don't use designer) - but the QtCreator help for TreeView shows the QQC1 documentation.



  • @ocgltd said in selectionMode property not available in TreeView 2:

    but the QtCreator help for TreeView shows the QQC1 documentation.

    That is really shitty. Contact qt for docs. This is a user forum and I don't think anyone here works for Qt. Are their docs in the build stuff for the module? Like a make docs or something?



  • There are quite a few problems with the TreeView 2 docs - there is already post already escalating this issue.

    Even conceptually I'm unsure about how things work:

    Shouldn't a selectionMode be tied to a view? The way I read the TreeView 2 docs the ItemSelectionModel is an independant object that I add/delete items to/from. In that case why bother with the 'flags' method in QAbstractItemModel? If I need to add/remove to/from the selection model on my own, can't I just ignore those flags? As well, shouldn't 2 views allow different items be selectable? (So why associated the selectable flag with the QAbstractItemModel)


Log in to reply