Results 1 to 3 of 3

Thread: Different positions of text fields with same layout

  1. #1
    Join Date
    Nov 2010
    Posts
    63
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Different positions of text fields with same layout

    I suppose this qualifies as regarding Qt Designer, althought it's maybe a general programming issue.

    I have 5 lines where the user is supposed to select up to 5 different files (see screenshots). The structure is all the same except that the last two files have an additional check box associated with them (currently textless).
    I would like the 5 file names to appear exactly beneath each other in the same column, regardless of whether they have a check box or not.
    To achieve that, I've placed the 5 groups in 5 horizontal layouts, put horizontal spacers in place of the check box for the first 3 groups and set the stretch factors of the elements to the exact same values for all 5 layouts (2,5,25,4,4 in this case).

    Still, the file text in the groups with check boxes is not in line with the others but offset to the right.
    The check boxes are not at their minimum size, so they could shrink to give the desired behaviour. If I decrease their stretch factor, I get the same effect in the other direction, i.e. an offset to the left side.

    I noticed that there is also a visual offset already in design mode, albeit apparently less pronounced (at least to my eye).

    Have I missed something about layout logic ?
    What can I do ?
    Thank you !

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Different positions of text fields with same layout

    If it turns out to not be possible, there is always the possibility of adding an extra column for just the checkboxes with no label.

  3. #3
    Join Date
    Nov 2010
    Posts
    63
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Different positions of text fields with same layout

    Quote Originally Posted by mvuori View Post
    If it turns out to not be possible, there is always the possibility of adding an extra column for just the checkboxes with no label.
    I'm not quite sure what you mean.
    You mean build all layouts first without the check box element and then add the check boxes to some, or build all layouts and use empty columns where I now have spacer items ?
    And how would I do that ? I'm building the form in Designer and there doesn't appear to be the option to add empty columns. So I guess I would need to add it in the code ?
    Are you referring to QLayout's addItem method ? What would I be adding then ? Wouldn't I end up adding a spacer item anyway ?

    Sorry for the plethora of questions. Thanks for the fast answer though. :b

Similar Threads

  1. Positions at Noida, India
    By nish in forum Jobs
    Replies: 0
    Last Post: 24th February 2011, 14:58
  2. Layout long text in QTableWidget
    By Tamtam in forum Newbie
    Replies: 0
    Last Post: 13th February 2009, 16:09
  3. ListWidget positions item
    By talex in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2008, 16:16
  4. Replies: 3
    Last Post: 26th November 2007, 09:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.