How can I determine the height of a single item in a QListWidget? I'm looking for the equivalent of Q3ListBox::itemHeight, or MFC's CListBox::GetItemHeight:
http://msdn.microsoft.com/en-us/library/d5804hcf.aspx
How can I determine the height of a single item in a QListWidget? I'm looking for the equivalent of Q3ListBox::itemHeight, or MFC's CListBox::GetItemHeight:
http://msdn.microsoft.com/en-us/library/d5804hcf.aspx
Using visualRect you can determine the height.
Mithin
www.mithin.in
or you can directly go for QListWidget::visualItemRect(QListWidgetItem);
Thanks guys! QListWidget::visualItemRect worked, but the more generic QAbstractItemView::visualRect returned a height of zero. I'm not sure why there's a discrepancy.
How did you call QAbstractItemView::visualRect ???
Now that I try it again, it works.
At the end itemRect1 == itemRect2;Qt Code:
To copy to clipboard, switch view to plain text mode
Bookmarks