Results 1 to 6 of 6

Thread: QGridLayout - specific widh-hight by percentage

  1. #1
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGridLayout - specific widh-hight by percentage

    I need to stick into a QGridLayout several widgets. So far nothing special. The different is that I need to specify the hight/widths by percentage, and that is not really how QGridLayout works.

    My idea is to maintain the widths,hights myself and do the layout manually "on resize".

    What alternatives do I have?
    Last edited by elcuco; 20th May 2010 at 15:12.

  2. #2
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGrigLayout - specific widh-hight by percentage

    use QBoxLayout::setStretchFactor

  3. #3
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGrigLayout - specific widh-hight by percentage

    Quote Originally Posted by borisbn View Post
    use QBoxLayout::setStretchFactor
    I don't understand. You are telling me to create y horizontal layouts, and then stick those inside another verstical layout (that y+1 layouts) and manage the whole layout myself?

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QGridLayout - specific widh-hight by percentage

    You'll be much better off and gain a lot of flexibility if you write your own layout manager, instead of placing unmanaged widgets by hand and manipulating their raw positions and sizes.

  5. #5
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGridLayout - specific widh-hight by percentage

    By looking at examples/layouts/dynamiclayouts/ I see that I am looking for:

    QGridLayout::setColumnStretch()
    QGridLayout::setRowStretch()

  6. #6
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGridLayout - specific widh-hight by percentage

    Lets continue this thread:

    Now, I am putting Phonon::VideoWidget() inside the layout, and the size of the "layout" changes according to the content of the Video, instead of the video resize to the content of the layout.

    How can I force the Video to be resize to the size of the layout, and not the other way?

Similar Threads

  1. Fonts from specific directory
    By praveen_g in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2009, 10:23
  2. XML Getting attributes of a specific value
    By di_zou in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2009, 12:04
  3. Plotting specific points with qwt
    By byb810 in forum Qwt
    Replies: 0
    Last Post: 30th July 2009, 15:42
  4. Looking for a specific webcam...
    By hickscorp in forum General Discussion
    Replies: 0
    Last Post: 24th January 2008, 16:07
  5. Changing a row hight
    By nnidza in forum Qt Programming
    Replies: 1
    Last Post: 25th December 2006, 08:57

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.