Results 1 to 4 of 4

Thread: How to resize programmatically like the user with the mouse?

  1. #1
    Join Date
    Apr 2008
    Posts
    39
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to resize programmatically like the user with the mouse?

    Hi.

    I want to resize a dialog like the user can do with the mouse. An example:

    The user cannot resize the dialog to 0 x 0 but if I call resize(0, 0) the dialog disappears.

    I hope you now what I mean.

  2. #2
    Join Date
    Sep 2007
    Location
    Vienna, Austria
    Posts
    19
    Thanks
    10
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: How to resize programmatically like the user with the mouse?

    I assume that you want to fit your width and height to the minimum and maximum size hint

    Qt Code:
    1. if (your_width < minimumSizeHint().width())
    2. {
    3. your_width = minimumSizeHint().width();
    4. }
    5. else if (your_width > maximumSizeHint().width))
    6. {
    7. your_width = maximumSizeHint().width();
    8. }
    9.  
    10. if (your_height < minimumSizeHint().height())
    11. {
    12. your_height = minimumSizeHint().height();
    13. }
    14. else if (your_height > maximumSizeHint().height())
    15. {
    16. your_height = maximumSizeHint().height();
    17. }
    18.  
    19. resize(your_width, your_height);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Apr 2008
    Posts
    39
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to resize programmatically like the user with the mouse?

    That is just what I wanted. Thank you!

  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: How to resize programmatically like the user with the mouse?

    J-P Nurmi

Similar Threads

  1. Replies: 2
    Last Post: 24th July 2006, 18:36

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.