Results 1 to 9 of 9

Thread: Problem with resizing dialog

  1. #1
    Join Date
    Feb 2006
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Problem with resizing dialog

    Hi all,

    I have written a small app and tried to align the controles in the layout properly. When app comes up it looks good. But when I resize the window using mouse making it smaller layout is messed up. Can some body please explain am I wrong here. I have attached the sample.

    Thanks in advance,
    Seema Rao

    menus.tar.gz

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with resizing dialog

    Quote Originally Posted by Seema Rao
    when I resize the window using mouse making it smaller layout is messed up.
    But what exactly is wrong? Maybe it's just a matter of setting a minimum size for the central label?

    Note that layouts will ignore everything you have set with setGeometry().

  3. #3
    Join Date
    Feb 2006
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with resizing dialog

    Its not only matter with centered QLabel, even buttons that I have subclassed fail to adapt to Layout when resizing!!

    Can some body please help!!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with resizing dialog

    Quote Originally Posted by Seema Rao
    Its not only matter with centered QLabel, even buttons that I have subclassed fail to adapt to Layout when resizing!!
    Could you post an image that shows the correct behavior or at least describe it?

  5. #5
    Join Date
    Feb 2006
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with resizing dialog

    whencreated.png

    whenresized.png

    here is the screen shots of image I got when window is created, but when I resized it, it looks like second one. why this happens even I have bound the controls to the layout?

  6. #6
    Join Date
    Jan 2006
    Location
    Cambridge, MA
    Posts
    32
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with resizing dialog

    Can you post the code to this dialog and the custom buttons? I think you have a bad sizeHint() somewhere. What's your baseclass for thses buttons? You may need to override sizeHint()const and minimumSizeHint()const in your button class.

    --Justin Noel
    justin@ics.com

  7. #7
    Join Date
    Feb 2006
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with resizing dialog

    I have posted the whole sample's source files in the first thread!!

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with resizing dialog

    Quote Originally Posted by Seema Rao
    when I resized it, it looks like second one.
    What is wrong with that? I'm not sure what do you want to achieve.

  9. #9
    Join Date
    Jan 2006
    Location
    Cambridge, MA
    Posts
    32
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with resizing dialog

    I read your code.

    The tool buttons are disappearing because thier sizeHint() and minuminSizeHint() are returning QSize(0,0) whcih is the default inherited from QWidget. QAbstractButton implements no sizeHint().

    I suggest implementing minimumSizeHint() in TooButton to return the size of your pixmap. Then habd sizeHint() return that valut too so...

    ToolButton::minimumSizeHint() const
    {
    return m_myPixmap.size(); //Or wheverever you are getting the pixmap from.
    }

    ToolButton::sizeHint() const
    {
    return minimumSizeHint();
    }

    --Justin Noel
    justin@ics.com

Similar Threads

  1. Issue with Modelless dialog on Mac
    By Satyanarayana Chebrolu in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2009, 10:10
  2. Resizing the dialog boxes
    By anju123 in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2007, 10:41
  3. Resizing the dialog box dynamically
    By vvbkumar in forum Newbie
    Replies: 5
    Last Post: 20th June 2006, 08:54
  4. Show/hide part of dialog with resizing.
    By Spockmeat in forum Qt Tools
    Replies: 6
    Last Post: 7th June 2006, 08:22
  5. Modifying Dialog problem
    By donmorr in forum Qt Tools
    Replies: 5
    Last Post: 26th May 2006, 12:56

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.