Results 1 to 3 of 3

Thread: QTreeView item contains customised widget which is not working as I expected

  1. #1
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeView item contains customised widget which is not working as I expected

    Hi Everyone,
    I am using a customised widget which contains 2 QPushButton and I have added that customised widget as a QTreeView item using setIndexWidget method. Now when I select the empty spaces in the customised widget I receive the signal
    clicked ( QModelIndex ). But if I click on the QPushButton which is there in the customised widget dont give me any clicked ( QModelIndex ) signal, however I am receiving the normal clicked() signal for the QPushButton. Is there anyway to get the clicked(QModelIndex) signal clicking this QPushButton in the cutomised widget?

    Any help will be appreciated.

    Thanks.
    Chandan

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeView item contains customised widget which is not working as I expected

    Read documentation! See bottom of QAbstractItemView::setIndexWidget.
    Quote Originally Posted by Nokia
    This function should only be used to display static content within the visible area corresponding to an item of data. If you want to display custom dynamic content or implement a custom editor widget, subclass QItemDelegate instead.
    So use QAbstractItemView::setItemDelegate. See QAbstractItemDelegate

  3. #3
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeView item contains customised widget which is not working as I expected

    Thanks but I think what I was looking for is right and I found the solution from my code.

Similar Threads

  1. Replies: 2
    Last Post: 22nd December 2010, 10:37
  2. qmake INSTALLS variable not working as expected
    By andy.fillebrown in forum Newbie
    Replies: 4
    Last Post: 9th November 2010, 16:04
  3. Replies: 0
    Last Post: 17th August 2010, 14:37
  4. Replies: 10
    Last Post: 2nd August 2010, 14:07
  5. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 08:17

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.