PDA

View Full Version : How to set the height of row in QListView



sawerset
7th July 2009, 19:16
How to set the height of row in QListView?

Lykurg
7th July 2009, 20:02
How to set the height of row in QListView?
This is managed by the sizeHint() of your delegate.

sawerset
7th July 2009, 22:04
I tried to reimplement sizeHint in my delegate


QSize QPushButtonDelegate::sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index )
{
QSize s;
qDebug("sizeHint");
s.setWidth(option.rect.width());
s.setHeight(130);
return s;
}


but nothing hapense
What is wrong?

Lykurg
7th July 2009, 23:55
Do you see the debug message? How do you set the model and the delegate?

nish
8th July 2009, 02:28
did you forgot to add a const ?
QSize QPushButtonDelegate::sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index ) const