Results 1 to 4 of 4

Thread: aspect ratio of top-level widgets

  1. #1
    Join Date
    Jan 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default aspect ratio of top-level widgets

    Hello everyone,
    is there a cross-platform way of restraining the width/height ratio of a top-level widget to a fixed value in Qt 4.2 ?

    thanks

    André

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: aspect ratio of top-level widgets

    Maybe you can use a QBoxLayout with a single toplevel widget in it, and play with the horizontalStretch / verticalStretch parameters of the layout.

  3. #3
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: aspect ratio of top-level widgets

    Sorry for the double post !

    Maybe you can use a QGridLayout with a single toplevel widget in it, and play with the stretch factors for column / row !

    http://doc.trolltech.com/4.2/qgridla...tColumnStretch

  4. #4
    Join Date
    Jan 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: aspect ratio of top-level widgets

    thanks, but unfortunately that's not what I want. If I'm not mistaken, your suggestions would only affect the inner layout of widgets. What I want is to constrain top-level widgets, ie actually the windows themselves. Qt should tell the windowing system that the widget's window has a special resizing policy.

    What I tried until now was setting the resize policy for my widget to hasHeightForWidth() and reimplementing heightForWidth() (works only for child widgets) and issuing resizes by either calling QCoreApplication:ostEvent or resize() in my resizeEvent-handler (infinite calling of resizeEvent(), as stated in the manual).

Similar Threads

  1. Replies: 11
    Last Post: 7th July 2006, 13:09
  2. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.