Results 1 to 2 of 2

Thread: How to bind signal of item in QAbstractListModel to handler in delegate of ListView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2014
    Posts
    20
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default How to bind signal of item in QAbstractListModel to handler in delegate of ListView

    I have a QAbstractListModel descendant class with list of instances of my arbitrary type MyItem inside. Also I have a ListView with model binding to that QAbstractListModel descendant.

    All I want to do is to bind handler in delegate of ListView to the signal of my arbitrary type MyItem. Is there any way to do it?

    UPD. I don't want to bind delegate to signal of a model so when I will have many items all of them will be triggered. I want to notify only one delegate with a signal.
    Last edited by ribtoks; 29th November 2015 at 20:10.

  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: How to bind signal of item in QAbstractListModel to handler in delegate of ListVi

    - Make a role that returns the object as a pointer.
    - use a Connections element to create a signal handler for the signal on that object

    Cheers,
    _

Similar Threads

  1. QAbstractListModel, QML ListView and crashes
    By marmistrz in forum Qt Quick
    Replies: 0
    Last Post: 3rd April 2013, 19:07
  2. QAbstractListModel does not update QML ListView
    By fonzi337 in forum Qt Quick
    Replies: 6
    Last Post: 16th April 2012, 20:12
  3. ListView model binding to QAbstractListModel
    By michalk in forum Qt Quick
    Replies: 1
    Last Post: 16th July 2011, 10:21
  4. Item Delegate - Relay a signal to editor widget
    By LynneV in forum Qt Programming
    Replies: 3
    Last Post: 5th July 2010, 17:36
  5. Item Delegate and Signal/Slot
    By LynneV in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2010, 15:16

Tags for this Thread

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.