PDA

View Full Version : How to implement expand/collapse functionality of logging output?



bobrien
18th July 2012, 17:41
Hi all,

I've written my own QDialog that monitors the startup procedure on one of our systems. What I am after is the ability to selectively expand or hide information about each of the steps that is happening.

I'm envisioning something similar to the dialog present when Ubuntu does its software updates - it gives a short text description of what its doing (e.g. "Installing..."), and then there is a triangle icon to its right that, when clicked, causes the dialog to expand to show the current log output (or stdout, or whatever), with the triangle going from side-pointing to down-pointing.

I found someone inquiring about something similar many years ago here:
http://lists.trolltech.com/qt-interest/2008-08/thread00130-0.html

The reason I hesitate to implement what was shown in that link is it seems like Qt should have this functionality already - QTreeView has the functionality and the icon, obviously there are a number of widgets for displaying text, but they don't seem to play nicely together.

Is there something more simple that I'm missing, or do I just have to implement it myself?

Thanks in advance,
Barry

wysota
18th July 2012, 20:30
Expanding dialog


... or just show/hide the "expanded" part as you need it regardless of size constraints.

bobrien
18th July 2012, 21:28
Sort of what I was afraid of...I was clearly making the problem much more complicated than it needs to be! Thanks!

Corollary question - does anyone know what the little triangle icons that indicate expand/collapse (such as in a QTreeView) are called? I'd like to use them (applied to a click-able label, for example) instead of a push button.

Thanks again,
Barry

wysota
19th July 2012, 09:32
I think they are QStyle::PE_IndicatorArrowUp and QStyle::PE_IndicatorArrowDown.