PDA

View Full Version : Collapzable widget



marc2050
25th April 2011, 11:38
Hi,

How do I create a widget that has a tiny little arrow that, when user clicks on it, it will collapse the widget into just a title bar. I see this sort of collapzable interface in other applications before. I could not find any examples or demo that show this in QT.
Any pointer please.

Thank you.
marc

wysota
25th April 2011, 11:49
Connect a checkable button that will serve as your "arrow" and connect its toggled(bool) signal to a setVisible(bool) (or setHidden(bool)) slot of the widget serving as a "body" of the widget you want. Or use QwwTaskPanel from wwWidgets (http://www.wysota.eu.org/wwwidgets/) if it suits your needs.

nish
25th April 2011, 11:52
i think if u just resize your widget to a minimum height (0 maybe) then u can get the desired effect.

EDIT: too late

EDIT2: if he hides the toplevel widget then the whole window with title bar will hide.

marc2050
25th April 2011, 12:20
So we're saying there is no built in function. But rather has to be achieved through some kind of tricks?

SixDegrees
26th April 2011, 07:22
No; they're saying that the functionality to do this is present, and that you simply have to write code to make use of it.

wysota
26th April 2011, 16:06
if he hides the toplevel widget then the whole window with title bar will hide.
Nobody said he should use top-level windows. That's a different mechanism.

nish
6th May 2011, 10:55
Nobody said he should use top-level windows. That's a different mechanism.
I thought he was talking about toplevel when i saw the "Title bar" and the collapse behavior which is present in many gnome themes.

wysota
6th May 2011, 11:38
Collapsing (or actually "shading") a window is a feature of the windowing system and not the application. You can only hint the OS to shade the window by setting Qt::WindowShadeButtonHint.

nish
6th May 2011, 11:48
Collapsing (or actually "shading") a window is a feature of the windowing system and not the application. You can only hint the OS to shade the window by setting Qt::WindowShadeButtonHint.
yes.. and i was under impression that he want to mimic that behavior where it is not available (Windows).