Results 1 to 2 of 2

Thread: Adjusting Widget size in a QGridLayout

  1. #1
    Join Date
    Apr 2007
    Posts
    20
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Adjusting Widget size in a QGridLayout

    Dear Denizons of QtCenterForum/Programming:

    Is there any simple way to adjust the relative sizes (spans) of Widgets in a QGridLayout? I'd like to be able to increment or decrement the spans from some signal, e.g. a context menu.

    I looked at the code in the DynamicLayouts example and it looks like they removed all the widgets and then added them back again readjusted. That means the window has to maintain another list of the widgets. That seems clumsy.

    Any better approach known out there?

    Thanks,
    Max

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adjusting Widget size in a QGridLayout

    Write your own layout and add smart updating to it.
    As a result of that signal you just tell the layout you want some widget to span across 3 cells, not one as it originally was.

    Otherwise maybe you can work something out with setRowStretch and setColumnStretch.

    I looked at the code in the DynamicLayouts example and it looks like they removed all the widgets and then added them back again readjusted. That means the window has to maintain another list of the widgets. That seems clumsy.
    No, you just take the widgets out, create another layout and add them in the new layout, which you set in place of the old one.

    Regards
    Last edited by marcel; 30th July 2007 at 22:23.

  3. The following user says thank you to marcel for this useful post:

    Max Yaffe (7th August 2007)

Similar Threads

  1. Margin size of QGridLayout
    By Cainofnod in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2007, 08:59
  2. Need to know widget size before first shown
    By durbrak in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2007, 20:37
  3. Designer not adjusting size right
    By Brandybuck in forum Qt Tools
    Replies: 8
    Last Post: 29th July 2006, 10:35
  4. Size of a plugin widget in designer
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2006, 13:29
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.