Results 1 to 1 of 1

Thread: How to implement a custom delegate?

  1. #1
    Join Date
    Sep 2011
    Posts
    20
    Qt products
    Qt5
    Platforms
    Windows

    Default How to implement a custom delegate?

    EDIT: This has been solved. Correct way to draw is to use option.rect.adjusted(1, 1, -1, -1).

    Here's the code: https://gist.github.com/labyrinthofd...fc5e06b1aa0115

    I add the delegate and the model like this:

    Qt Code:
    1. ui.personView->setItemDelegate(new fg::SimpleDirectorDelegate(ui.personView));
    2. ui.personView->setModel(new fg::DirectorModel(ui.personView));
    To copy to clipboard, switch view to plain text mode 

    ui.personView is a QListView with uniformItemSizes set to "true".

    It "works". Except when I scroll or hover over the rows the rows keep disappearing/appearing.
    Last edited by themagician; 26th August 2015 at 21:16. Reason: Solved

Similar Threads

  1. how to implement the listwidget delegate?thanks
    By liuqin820222 in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2013, 08:42
  2. How to implement delegate in QHeaderView
    By riarioriu3 in forum Newbie
    Replies: 1
    Last Post: 10th August 2012, 07:23
  3. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 21:23
  4. Replies: 0
    Last Post: 1st February 2010, 12:00
  5. Question about custom view (or custom delegate)
    By skuda in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2009, 21:06

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.