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 more than one delegates in listview
Forum Updated to NodeBB v4.3 + New Features

How to select more than one delegates in listview

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 952 Views 2 Watching
  • 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.
  • J Offline
    J Offline
    jd42
    wrote on last edited by
    #1

    Hi all,
    i have a listview with readonly text delegates, how can i visually select more than one delegates by pressing and moving the mouse over multiple delegates? E.g. there are multiple chat messages and i want to select some of them to be able to copy them. Is there any way to do that?

    Thanks in advance.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Padlock
      wrote on last edited by
      #2

      Does this (https://stackoverflow.com/questions/38438235/multiple-items-selection-from-listview) answer your question?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sharath
        wrote on last edited by sharath
        #3

        @jd42 why do you want to select more than one delegate? Do you want to delete particular or group of index from list view or you want to copy that index?

        First of all you have to implement Pressandhold and Onclick functionality on mouseArea and specify z=-1
        import QtQuick 2.7
        import QtQuick.Controls 1.4
        import QtQuick.Controls 2.1

        import "Utilitiesforarray.js" as Utilsarray
        property bool flag: false
        MouseArea
        {
        id:mouseareaforselecting
        anchors.fill: parent
        z:-1
        onPressAndHold:
        {
        //initially flag becomes flase, after PressandHold the flag becomes true
        if(flag===false)
        {
        patientdetailslist.currentIndex=index
        rectfordelegate.color="sky blue"
        flag=true;
        Utilsarray.pushIndex(index); //storing index in array, i have method called pushIndex in Utilitiesforarray.js file
        }
        }
        //now you can select how many delegates you want
        onClicked:
        {
        if(flag===true)
        {
        //store the index values into JavaScript array
        }
        else
        {
        //do your stuff
        }
        }

        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