Results 1 to 6 of 6

Thread: QtDesigner Layout Help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: QtDesigner Layout Help

    Indeed, splitters behave oddly (even in Qt 4.2 TP1). AFAIR you can fix that with QSplitter::setStretchFactor(), but you have to do this in code.

    QSplitter docs say:
    The initial distribution of size between the widgets is determined by the initial size of each widget.
    Which might mean that stretch factors are just ignored. Maybe the Trolls will be able to explain this behavior.

  2. #2
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtDesigner Layout Help

    Quote Originally Posted by jacek
    Indeed, splitters behave oddly (even in Qt 4.2 TP1). AFAIR you can fix that with QSplitter::setStretchFactor(), but you have to do this in code.

    Which might mean that stretch factors are just ignored. Maybe the Trolls will be able to explain this behavior.
    Weird. It seems to work better when the splitter is a vertical, but when it is horizontal, all bets are off. I then thought it was the "frame" widget itself, but any other widget seems to do the same thing. I'm really at a loss at this point as I wonder how useful QtDesigner will be to my project going forward. In complex main widow-type widgets the relative size of enclosed widgets is really important, but it seems that if I want my users to be able to resize each individual widget at runtime, then I'll need to do a lot of hand coding which kinda defeats the purpose of QtDesigner.

    I'm posting a bugreport now so at the very least, we will hopefully get some understanding whether it really is a bug or some sort of "feature".

  3. #3
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtDesigner Layout Help

    Hello All-

    I received a follow up from Trolltech concerning the bug report I submitted. Sure enough, the order of widget instantiation does matter. To make this work with QSplitters, you must set the stretch factors on the horizontal QSplitter (the one between the table and the frame) _before_ instantiating the vertical QSplitter between the table/frame-layout and the tree view. This works and addresses my problem perfectly. I can now have the widgets of the correct size with QSplitters between.

    The open issue is still that this order matters and that once you have set the stretch factors, with QSplitters involved, any future manipulation of stretch factors in future QtDesigner sessions will not be taken into account. The only way to manipulate stretch factors again would be to destroy the QSplitters and break the overall Grid layout, then make your changes, then re-instantiate the QSplitters in the correct order (and with correctly timed stretch factor changes to those QSplitters). Future versions of Qt may fix this problem, but it is a current problem nonetheless.

    -Lance

  4. The following user says thank you to mentat for this useful post:

    jacek (13th July 2006)

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Dynamic grid layout
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2006, 15:19
  3. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 07:16
  4. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 19:57
  5. Is there a resizeable layout
    By seneca in forum Qt Tools
    Replies: 2
    Last Post: 14th January 2006, 20:04

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
  •  
Qt is a trademark of The Qt Company.