Results 1 to 2 of 2

Thread: Dynamic grid layout

  1. #1
    Join Date
    Jun 2006
    Posts
    11
    Thanked 4 Times in 4 Posts

    Default Dynamic grid layout

    I'm looking for the best way to lay out a dynamic number of controls in a grid. I need to be able to add or remove controls from the layout and change the number of controls per row (in effect change the number of cols and rows). I've tried using a QGrid-control but it does not support changing the number of cols/rows (and has some other issues) and I've looked at the QGridLayout, however it does not support decreasing the number of cols/rows.

    My current solution is to create a new QGrid with the right dimensions, move all controls from the old QGrid (which is then deleted) and add the new QGrid to the dialog layout. However this is not a particulary good solution and I was wondering if someone had a better.

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic grid layout

    I'd suggest to create a custom layout. You may have a look at the source of QGridLayout to understand how it works and then customize it to fit your needs... The border layout example may be helpful as well...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 08:16
  2. How do I move a widget inside a grid Layout
    By barnabyr in forum Newbie
    Replies: 1
    Last Post: 9th May 2006, 00:23
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 13:45
  4. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 20:57
  5. Grid layout
    By nupul in forum Qt Programming
    Replies: 7
    Last Post: 21st April 2006, 22:15

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.