Results 1 to 2 of 2

Thread: Widget alignment.

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Widget alignment.

    Hey guys,

    I'm specifying a specific alignment in my layout :

    mLayout.addWidget(&mBubbleWidget, 0, indexVertical, Qt::AlignLeft);



    But I still want it to be stretchable by doing this :

    mLayout.setColumnStretch(indexVertical, 10);



    for some reason when setting alignment the child widget won't stretch.

    Any possibility to keep the stretchable behaviour with the left align flag ?

    Thanks.



    Ben.

  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: Widget alignment.

    If you set Qt::AlignLeft then why would you want the widget to stretch?
    One way is to create a wrapper widget with a horizontal layout, in which you add your widget + a spacer item( expanding policy ).

    The add this widget to the grid layout.

    Regards

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

    bunjee (27th May 2007)

Similar Threads

  1. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  2. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  3. Replies: 4
    Last Post: 10th March 2007, 18:01
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.