Results 1 to 3 of 3

Thread: Fixed height of Qt Vertical Box Layout. Anything else than putting it in new QWidget.

  1. #1
    Join Date
    Jan 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Fixed height of Qt Vertical Box Layout. Anything else than putting it in new QWidget.

    Hey all!

    I have a scroll area.
    What I want is to dynamically create and add QTextEdit (with different text) in this scroll area. And depending on some variables, current QTextEdit will placed on the left or right hand side.
    Think about facebook conversation : incoming messages will be on the left, and outgoing ones will be on the right.

    To add QTextEdit to this area, I use QVBoxLayout : I begin to add new QVBoxLayout and in that layout I add my QTextEdit. And again and again, new QVBoxLayout below the older ones. After that, I apply Qt:Alignement to each of these layouts.
    Why I add QVBoxLayout first ? Because It actually lets users to resize the window of the application while keeping the QTextEdit entirely visible in the area.

    My problem is when I add these layouts, they all are visible in the area, that means their sizes are reduced.
    I want them to have maximum height. Users will use the scrollbar of the scroll area to see other QTextEdit.

    Can someone help me ? Thank you ..

  2. #2
    Join Date
    Oct 2013
    Posts
    41
    Thanks
    1
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fixed height of Qt Vertical Box Layout. Anything else than putting it in new QWid

    Is the scroll area the whole application, or is there more outside the scroll area?

    So you want it to where when the scroll area is resized, the text edits are completely visible from a horizontal perspective, but from a vertical perspective some text edits are outside the view of the scroll area? Is that correct?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Fixed height of Qt Vertical Box Layout. Anything else than putting it in new QWid

    There is no "maximum height" for a QTextEdit. A QTextEdit will grow as tall (or short) as you let it.

    A vertical layout will size the text areas into the space available in the widget the layout is applied to: in this case the container widget inside the scroll area view port. If you don't increase its size when you add new material then existing material shrinks to accommodate it. You can have the container widget automatically adopt the size of the accumulated sizeHint()s of child widgets using a Fixed vertical size policy. See the "Extension Example" in Assistant.

Similar Threads

  1. Fixed QMainwindow size, Layout question
    By Nyte in forum Newbie
    Replies: 3
    Last Post: 30th January 2013, 12:33
  2. Fixed-height layout question
    By TheJim01 in forum Newbie
    Replies: 1
    Last Post: 16th March 2010, 21:37
  3. QWidget with fixed width height ratio
    By Lodorot in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2009, 09:49
  4. vertical layout of wid gets in the status bar?
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2009, 15:58
  5. Putting Widgets into a Layout
    By jcoop in forum Newbie
    Replies: 16
    Last Post: 18th April 2009, 23:00

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.