Results 1 to 7 of 7

Thread: Same size items with grid positions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2017
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Same size items with grid positions

    Sorry, I did not express myself correctly, I want items spread, on each line the spaces between items are all the same.
    Last edited by MathFurious; 2nd March 2018 at 21:10. Reason: reformatted to look better

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,323
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Same size items with grid positions

    OK, that isn't a whole lot different. To keep the layout class as generic as possible, you still need to calculate the width of all the items in each row, then adjust the x positions so that the space between each item is the same. This padding space will be equal to the leftover width / (nItems - 1). So, item 0 has no adjustment (it sits at the left margin of the layout), item 1 sits at item0.x + item0.width + padding, item 2 at item1.x + item1.width + padding, etc.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2017
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Same size items with grid positions

    Ok, thanks.

Similar Threads

  1. Can't get positions of graphics items in scene
    By Kamalpreet in forum Newbie
    Replies: 7
    Last Post: 30th August 2014, 19:04
  2. Replies: 0
    Last Post: 30th April 2013, 17:32
  3. Replies: 3
    Last Post: 11th December 2011, 10:09
  4. Replies: 0
    Last Post: 26th October 2010, 17:59
  5. Replies: 2
    Last Post: 5th March 2009, 10:34

Tags for this Thread

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.