Results 1 to 7 of 7

Thread: Expanding/shrinking a widget

  1. #1
    Join Date
    Oct 2007
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question Expanding/shrinking a widget

    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?t...panding_dialog) on the wiki, but it doesn't work

    Do you have an idea ?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Expanding/shrinking a widget

    Could you post some kind of minimal compilable test case for us to play with?
    J-P Nurmi

  3. #3
    Join Date
    Oct 2007
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Expanding/shrinking a widget

    Hello,

    Yes, I made you a complete compilable project.
    Attached Files Attached Files
    Last edited by punkypogo; 13th May 2008 at 13:24.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Expanding/shrinking a widget

    Hmm, what's the point of using QDockWidget but no QMainWindow?
    J-P Nurmi

  5. #5
    Join Date
    Oct 2007
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Expanding/shrinking a widget

    I know, it is not supposed to be used like that.

    But I want it to be that way

    edit : unless you have an idea to have the same behavior.
    Last edited by punkypogo; 13th May 2008 at 14:16.

  6. #6
    Join Date
    Oct 2007
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Expanding/shrinking a widget

    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.
    Attached Files Attached Files

  7. #7
    Join Date
    Oct 2007
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Expanding/shrinking a widget

    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.
    Attached Files Attached Files

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  3. Replies: 3
    Last Post: 17th October 2007, 12:52
  4. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.