PDA

View Full Version : Expanding/shrinking a widget



punkypogo
6th May 2008, 12:50
Hello,

In my app, I have a dockwigdet in which there is a (promoted) widget.
This widget has a more/less button : when I click on "more", the widget expands to show advanced options, and when I click on "less", the widget shrinks hiding the advanced options.

My problem is that when I click on "less", the dockwidget doesn't shrink at all, letting tons of space, which is ugly.

I saw this article (http://wiki.qtcentre.org/index.php?title=Expanding_dialog) on the wiki, but it doesn't work :(

Do you have an idea ?

jpn
12th May 2008, 19:43
Could you post some kind of minimal compilable test case for us to play with?

punkypogo
13th May 2008, 13:18
Hello,

Yes, I made you a complete compilable project.

jpn
13th May 2008, 13:47
Hmm, what's the point of using QDockWidget but no QMainWindow?

punkypogo
13th May 2008, 14:10
I know, it is not supposed to be used like that.

But I want it to be that way :D

edit : unless you have an idea to have the same behavior.

punkypogo
21st May 2008, 14:05
Hello,

Well, I followed your remark, jpn, and I tried to obtain what I want in a different way.

The main widget "Extension" has a promoted widget "Widget" in a gridlayout.
Widget can attach or detach itself from Extension thanks to the attach/detach button.

This approach is a bit better than the "fake" dockwidget one, but it's not perfect :
- Widget can attach or detach : OK
- Widget resizes well when attached in Extension, when the more/less button is activated : OK
- Widget does not resizes well when detached from Extension : FAIL.


My new project is attached.


Thanks in advance,
Cheers.

punkypogo
27th May 2008, 16:50
Hello,

Thanks to the Qt Support, I could achieve my goal.

Here are the new version of widget.h and widget.cpp, it could be useful to someone.