model view controller - Size of element depending on size of the QListView -


I am developing a program that draws in the list elements (QListView). How can I set the size of an element based on the size of QListView? I write the implementation of sizeHint in the delegation, but where can I get the example size QListView I do not know.

solution:

  QSize SpinBoxDelegate :: sizeHint (const QStyleOptionViewItem and Option, const QModelIndex and index) const {QStyleOptionViewItemV4 opt (option); QDebug ("W =% d \ n", opt.widget-> Width ()); QDebug ("H =% d \ n", opt.widget-> height ()); Return QSize (100, 100); }  

Comments