Results 1 to 6 of 6

Thread: Adding line in layout.

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Adding line in layout.

    Hi

    I am trying to add line in a layout through coding, but i do not find name of line class.I am trying to add line which are present in qt designer toolbox.
    please tell me how to add them in a layout.
    One more thing when i am adding space in a gridlayout , it does not effect anything in display.
    My code for adding space is

    Qt Code:
    1. QSpacerItem *spacerItem = new QSpacerItem(300, 20, QSizePolicy::Expanding);
    2. grid->addItem(spacerItem, 4, 0, 4, 1);
    To copy to clipboard, switch view to plain text mode 

    Actually i want to leave first column of layout blank.

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

    Default Re: Adding line in layout.

    Quote Originally Posted by Niamita View Post
    Actually i want to leave first column of layout blank.
    Then just don't add anything there and it will be blank.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Adding line in layout.

    i do the same but second column widget stretch in first and second column.

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

    Default Re: Adding line in layout.

    Should any line in first column contain something that is not empty? If not, what is the point in having the empty space in the first place?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Adding line in layout.

    I have gridlayout which i want to set in window after leaving some gap from left of the window(like first column in whole layput does not contain any widget).

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

    Default Re: Adding line in layout.

    Ok, but my question is why you want to leave the gap. You can do that using the spacer code you posted if you use the Minimum size policy however that's probably not the best solution.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 12th December 2010, 05:09
  2. QTextStream not adding new line
    By hokie2012 in forum Qt Programming
    Replies: 6
    Last Post: 16th September 2010, 22:50
  3. Replies: 6
    Last Post: 23rd August 2010, 17:56
  4. Adding a Layout to QMainWindow
    By Chiggins in forum Qt Programming
    Replies: 2
    Last Post: 7th June 2010, 06:25
  5. A question about adding to layout
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 12:41

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.