[Qt-interest] Set size of QListView

koan emptystate at yahoo.co.uk
Mon Feb 2 12:52:15 CET 2009


Hi

I am having great difficulty setting the size of a QListView, it's perhaps a
design problem but I can't make any progress on it.

I have a QWidgetStack with a QVBox on it. In the QVBox I have
a QListView and a QTextBrowser (supposedly) split 50:50.

I have a resize function for the qlistview and qtextbrowser, called by
the qwidgetstack's resizeEvent.

Sometimes I update all the items on the list view by doing a clear() and
then adding them all back in.

I know clear() is also doing a content size recalculation and update.

I just can't get the qlistview and qtextbrowser to share the space 50:50. It
seems that the qlistview changes it's onscreen size every time you add an
item. Another problem is that when I resize to 50:50 the qtextbrowser
doesn't get repositioned in the qvbox, so it's in the wrong place and most
of it's content is not visible.

What should I do and how ?
A. Try to make the qvbox relayout the children
B. Write resizeEvents for the two widgets
C. Try to shift the qtextbrowser
D. Individually delete the QListViewItems to avoid an update
E. other

By the way, does QListView::visibleArea() work properly ? My previous
implementation used QTables and I got different results.

My system is Qtopia 1.5.4 on a Sharp Zaurus, so if all that talk of QVBoxes
made you feel old, please don't tell me I should upgrade to the latest QT.

Thanks in advance.



More information about the Qt-interest-old mailing list