Results 1 to 2 of 2

Thread: ListView - ListView communication

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default ListView - ListView communication

    Dear Sirs and Madams!

    I have two ListView's, let say, ListView A and ListView B. Now, lets say I select item from ListView A and then ListView B pops up. The problem is, how do I know in ListView B, which item was pressed (its index) in ListView A or better, how do I address ListView A's model in ListView B to get item?

    Sincerely,
    Marko
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ListView - ListView communication

    You can
    - address ListView A's currentItem
    - address ListView A's current index
    - let ListView A's delegate when it is clicked, store its index in a property accessible to ListView B

    If the model used by ListView A has an id that is also visible for ListView B then you can just access it.
    If the id is not visible to ListView B, then you could store it in a property that ListView B has access to.

    Cheers,
    _

Similar Threads

  1. listview
    By ganeshgladish in forum Newbie
    Replies: 1
    Last Post: 23rd June 2013, 11:51
  2. Qml Listview
    By ganeshgladish in forum Newbie
    Replies: 1
    Last Post: 19th June 2013, 09:41
  3. should i use listview ?
    By rimie23 in forum Qt Programming
    Replies: 20
    Last Post: 9th May 2012, 23:40
  4. qml listview
    By Le_B in forum Qt Quick
    Replies: 1
    Last Post: 25th May 2011, 14:01
  5. listview
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2009, 13:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.