Results 1 to 3 of 3

Thread: precise definition of layout algorithms!

  1. #1
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default precise definition of layout algorithms!

    OK so every Layout is different, but all QtGui Layouts will use the following widget properties in determining their position on the screen: sizeHint, minimumSize, maximumSize, minimumSizeHint, sizePolicy. This section of the documentation alludes to a common algorithm or set of semantices for these properties http://doc.qt.nokia.com/4.7/layout.h...ts-to-a-layout. However 1. It must be innacurate because it cant apply to more complicated layouts? 2. I cant help but think it is innaccurate any way because it states:

    1. All the widgets will initially be allocated an amount of space in accordance with their QWidget::sizePolicy() and QWidget::sizeHint().
    This cannot be correct because elsewhere in the documentation it is stated sizePolicy reinterprets the meaning of size hint (http://doc.qt.nokia.com/4.7/qsizepolicy.html#details); THERE IS NO SCOPE for reinterpreting anything in "will initially be allocated" - the widget is allocated a size not a min/max size and that size must, be according to the above statement, the size hint. So the statement should be:

    1. All the widgets will initially be allocated an amount of space in accordance with their QWidget::sizeHint().
    And then it should explain what happens if a widget has no size hint - which is possible (http://doc.qt.nokia.com/4.7/qwidget.html#sizeHint-prop).

    Anyway I was wondering if anyone could point me in the direction of a more rigorous description of the layot algorithms - short of the source.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: precise definition of layout algorithms!

    Quote Originally Posted by 33333 View Post
    This cannot be correct because elsewhere in the documentation it is stated sizePolicy reinterprets the meaning of size hint
    I would say it complements the meaning of size hint.

    THERE IS NO SCOPE for reinterpreting anything in "will initially be allocated" - the widget is allocated a size not a min/max size and that size must, be according to the above statement, the size hint.
    I totally fail to see your point. A layout takes into consideration the size hint, the size policy and the stretch of the widget. The result is something that satisfies all of the three for every widget in the layout.

    And then it should explain what happens if a widget has no size hint - which is possible (http://doc.qt.nokia.com/4.7/qwidget.html#sizeHint-prop).
    A widget always has a size hint. It might be invalid but the hint is there (it's treated as 0).

    Anyway I was wondering if anyone could point me in the direction of a more rigorous description of the layot algorithms - short of the source.
    If you ask a specific question, you'll get a specific answer. I personally think the algorithm is pretty simple and easy to understand. Most of it is described in the docs for the size policy probably.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: precise definition of layout algorithms!

    THERE IS NO SCOPE for reinterpreting anything in "will initially be allocated" - the widget is allocated a size not a min/max size and that size must, be according to the above statement, the size hint.
    I totally fail to see your point. A layout takes into consideration the size hint, the size policy and the stretch of the widget. The result is something that satisfies all of the three for every widget in the layout.
    Hard to see out of context but the first step of the apparent algorithm is to assign a size to all widgets based on "size policy and size hint". My point was... I am asserting this is innaccurate. It just assigns size hint, size policy has nothing to do with it at this point.

    (it's treated as 0).
    Excellent thanks.

    I agree it seems to be fairly simple and intuitive.

Similar Threads

  1. Replies: 6
    Last Post: 28th March 2012, 00:11
  2. QGraphicsItem, QLineF Precise Selection
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 29th October 2009, 10:01
  3. Replies: 1
    Last Post: 1st February 2009, 18:36
  4. Coding Precise Layouts
    By JimDaniel in forum Qt Programming
    Replies: 6
    Last Post: 15th September 2007, 21:30
  5. Algorithms problem of brackets including.
    By luffy27 in forum General Programming
    Replies: 2
    Last Post: 12th April 2007, 01:10

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.