PDA

View Full Version : How to implement a custom delegate?



themagician
26th August 2015, 15:46
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/labyrinthofdreams/288e91fc5e06b1aa0115

I add the delegate and the model like this:


ui.personView->setItemDelegate(new fg::SimpleDirectorDelegate(ui.personView));
ui.personView->setModel(new fg::DirectorModel(ui.personView));

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.