Results 1 to 3 of 3

Thread: use QFrame as addStretch():

  1. #1
    Join Date
    Nov 2007
    Posts
    103
    Thanks
    71
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default use QFrame as addStretch():

    Is it possible to replace addStretch() with a line in such a way that it is not the emptiness that pushes widgets apart on the layout but rather a line?
    This is my line:
    Qt Code:
    1. QLabel *vDivider1 = new QLabel;
    2. vDivider1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    3. vDivider1->setLineWidth(2);
    To copy to clipboard, switch view to plain text mode 
    Can this be combined with layout->addStretch(); so that the line is stretched and pushes the widgets away from each other?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: use QFrame as addStretch():

    I'm not 100% sure if I understood the problem but I guess you could set an "expanding" size policy:
    Qt Code:
    1. vDivider1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    To copy to clipboard, switch view to plain text mode 
    PS. Wouldn't it be easier to use Qt Designer to handle all this?
    J-P Nurmi

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

    tommy (26th January 2008)

  4. #3
    Join Date
    Nov 2007
    Posts
    103
    Thanks
    71
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: use QFrame as addStretch():

    Yes, you understood the question 100% and you solved it!
    Thanks very much!

    P.S. Naah, I'm not a huge fan of Qt Designer.

Similar Threads

  1. Using a QFrame as a color selection indicator
    By KShots in forum Qt Tools
    Replies: 8
    Last Post: 14th June 2011, 23:55
  2. how to determine geometry of a QFrame
    By impeteperry in forum Qt Programming
    Replies: 3
    Last Post: 10th October 2007, 19:07
  3. QFrame inserting text
    By Pharell in forum Qt Programming
    Replies: 9
    Last Post: 8th October 2007, 09:55
  4. Setting background image of QFrame
    By Claymore in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2007, 19:50
  5. QFrame subclass does not reparent
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 21st March 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.