Nominate our 2022 Qt Champions!

Check for condition before updating a QtreeView Selection

  • Hey everyone,

    I'm still relatively new to Qt and just familiarized myself with the Model-View classes, especially the QtreeView and the QAbstractItemModel classes. Now I'd like to achieve the following: As soon as the user clicks on an item in the view, I'd like to be able to check for the validity of that selection before the selection becomes visible in the view. Is this actually possible? I can't seem to find a fitting function... :(. Thanks in advance!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If I understood you correctly you might try to look at QItemSelectionModel

    Hope it helps

  • Hey Gaist, thanks for the hint!

  • Lifetime Qt Champion

    You're welcome !

    It this works of you, don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply