Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to select a range with ItemSelectionModel?

How to select a range with ItemSelectionModel?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 4 Posters 913 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    The docs for ItemSelectionModel say you can pass a QItemSelection to ItemSelectionModel.select(selection, flags). Does anyone kn ow how this is possible? There is no ItemSelection type which would wrap QItemSelection. The docs are silent on this.

    I am trying to implement shift-select to toggle a range in a TableView 2.

    Thanks!

    https://alaskafamilysystems.com/

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      Why not set the SelectionMode of your view to QAbstractItemView::ExtendedSelection ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        This is about the QML type and not the C++ type. Unless I’m misunderstanding you?

        https://alaskafamilysystems.com/

        SGaistS 1 Reply Last reply
        1
        • P patrickkidd

          This is about the QML type and not the C++ type. Unless I’m misunderstanding you?

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @patrickkidd said in How to select a range with ItemSelectionModel?:

          This is about the QML type and not the C++ type. Unless I’m misunderstanding you?

          Sorry, I misread your post.

          Did you already saw this thread about that matter ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            @patrickkidd said in How to select a range with ItemSelectionModel?:

            This is about the QML type and not the C++ type. Unless I’m misunderstanding you?

            Sorry, I misread your post.

            Did you already saw this thread about that matter ?

            P Offline
            P Offline
            patrickkidd
            wrote on last edited by
            #5

            @sgaist said in How to select a range with ItemSelectionModel?:

            @patrickkidd said in How to select a range with ItemSelectionModel?:

            This is about the QML type and not the C++ type. Unless I’m misunderstanding you?

            Sorry, I misread your post.

            Did you already saw this thread about that matter ?

            That thread is about Controls 1 while my question pertains to Controls 2 and item models.

            https://alaskafamilysystems.com/

            1 Reply Last reply
            0
            • IntruderExcluderI Offline
              IntruderExcluderI Offline
              IntruderExcluder
              wrote on last edited by IntruderExcluder
              #6

              I've made an example 'on a knee', but it uses some cheats. Maybe someone can provide some better examples.
              Example

              P 1 Reply Last reply
              0
              • K Offline
                K Offline
                Kobid
                wrote on last edited by
                #7

                I also need multiselect functionality in my GridView. What I see, only TreeView has selection property which can hold selection model. In my case, multiselect should be activated only when user hold CTRL key in focused GridView, I'm trying to solve this with CheckDelegate and nextCheckState function callback

                1 Reply Last reply
                0
                • IntruderExcluderI IntruderExcluder

                  I've made an example 'on a knee', but it uses some cheats. Maybe someone can provide some better examples.
                  Example

                  P Offline
                  P Offline
                  patrickkidd
                  wrote on last edited by
                  #8

                  @intruderexcluder said in How to select a range with ItemSelectionModel?:

                  I've made an example 'on a knee', but it uses some cheats. Maybe someone can provide some better examples.
                  Example

                  I also am currently using a similar workaround where I have a C++ select(selectionModel, fromIndex, toIndex, SelectionFlags) that makes the call for me.

                  So then my original question is if it is possible to make the same call directly from Qml.

                  https://alaskafamilysystems.com/

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved