Results 1 to 4 of 4

Thread: Alignment issue

  1. #1
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Alignment issue

    Hey, this is probarly pretty obvious, and is just a case of me missing something (I've looked, I swear) but..

    I want to have a vertical row of labels, with horizontal lines aligned beside them.
    This image is my closest approximation:


    Now, this would be perfect if I could make the right column (the one with the horizontal lines in it) larger than the left, but as it stands, they're always equal and I can't see how to change that, leaving a big space between the text and the line.

    I've tried various combinations of box layouts, including two vboxes (one for labels, one for lines) and putting them beside each other, but the height differences between the label and line mean only one or two are ever aligned.

    Is there a 'sensible' way to do this, or should I just use a bit of maths to align everything, and use the window as a canvas?
    Preferably a solution I could do from within qtdesigner and then see how the code works.

  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: Alignment issue

    Why don't you use addStretch and QSpacerItems with your layout? With the correct combination you could achieve the proposed result.

    Regards

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

    tebs (24th April 2007)

  4. #3
    Join Date
    Apr 2007
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Alignment issue

    Ah, yes. I tried spacers earlier, but they only seemed to make it more unpredictable and difficult, but with a bit more dilligence, I did get something pretty close to what I wanted.
    Thanks very much.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Alignment issue

    You can also change the size policy of the items and the horizontal stretch. It will allow you to define proportions between the columns.

Similar Threads

  1. qt3 to qt4 - uic issue
    By hvengel in forum Qt Programming
    Replies: 10
    Last Post: 4th March 2007, 03:59
  2. Reg - QTable | Column alignment
    By suresh in forum Newbie
    Replies: 1
    Last Post: 18th December 2006, 16:58
  3. Regarding alignment in QTable
    By joseph in forum Qt Programming
    Replies: 4
    Last Post: 5th December 2006, 11:35
  4. Dialog and code design issue
    By Gopala Krishna in forum Qt Programming
    Replies: 1
    Last Post: 24th September 2006, 18:54
  5. Replies: 5
    Last Post: 22nd September 2006, 09: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.