[Qt-interest] QTreeView expanding: don't offer individual controls for nested items
Jan Kundrát
jkt at gentoo.org
Thu Jan 6 16:48:14 CET 2011
Hi,
I'm writing an e-mail viewer [1] and would like to modify the QTreeView
to handle threading "better". Right now, when a thread gets too deep,
the recent messages could easily be hidden in many levels of nesting,
and one would have to click through quite a lot of items in order to
finally reach the recent ones. On the other hand, being able to collapse
uninteresting threads is a handy feature. That's why I like
Thunderbird's GUI which displays the expanding/collapsing control just
for the top-level items (ie. in Qt interview speak, for those having an
invalid index as their parent). I'd like to do something similar in Qt.
I was thinking about reimplementing QTreeView::drawBranches(). If I did
that (it's a 100+ lines function, though), I'd have no indicators, but
mouse clicks would still work; it looks like mouse event handlers are
rather tied with QTreeViewPrivate, and that's where my library-user
abilities end. I'd also have to properly listen for expanded() on a
top-level item etc, but that's trivial; I think that the biggest
obstacle is disabling mouse controls for the "always expanded if parent
expanded" items.
So, any idea about how to make items whose parent is not an empty
QModelIndex always expanded?
Cheers,
-jkt
[1] http://trojita.flaska.net/
--
cd /local/pub && more beer > /dev/mouth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110106/c8e7e467/attachment.bin
More information about the Qt-interest-old
mailing list