Results 1 to 8 of 8

Thread: Scroll area on right side of main window

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Posts
    56
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Scroll area on right side of main window

    I added the dock view, and an item based list view inside. How do I make the item based list view always take up the entire area of the dock view? Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Innsbruck, Austria
    Posts
    62
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    10
    Thanked 7 Times in 6 Posts

    Default Re: Scroll area on right side of main window

    In Qt Designer, you may add a layout (e.g. a vertical layout). If you're adding the view by code, use QDockWidget::setWidget().

  3. #3
    Join Date
    Aug 2009
    Posts
    56
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Scroll area on right side of main window

    Is the QListWidget supposed to be a child of verticalLayout in ObjectInspector? If it's not a child the layout doesn't seem to do anything. If the QListWidget is a child, it doesn't fill the layout. It's like 1/4 of the layout, only in the center.
    Attached Images Attached Images

  4. #4
    Join Date
    Feb 2008
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 24 Times in 24 Posts

    Default Re: Scroll area on right side of main window

    Just follow this procedure:

    - Create a QMainWindow in Qt Designer.
    - Add a dock widget.
    - Add a QListWidget inside of the dock widget.
    - Select the dock widget by clicking on it.
    - Click the Form menu - Layout vertically.
    Voièla!

    Now you can resize the dock widget. The list widget will take the whole space.
    Attached Images Attached Images

  5. The following user says thank you to victor.fernandez for this useful post:

    rakkar (28th August 2009)

  6. #5
    Join Date
    Aug 2009
    Posts
    56
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: Scroll area on right side of main window

    Thanks. If I want to put a label above the list widget, the label takes up half of the vertical area of the dock widget. How do I get the label to only take up the necessary size to show it? I tried changing size policy to minimum but it doesn't do anything.

  7. #6
    Join Date
    Jan 2006
    Location
    Innsbruck, Austria
    Posts
    62
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    10
    Thanked 7 Times in 6 Posts

    Default Re: Scroll area on right side of main window

    Make sure the vertical size policy of the label is Preferred and the vertical size policy of the QListWidget is Expanding or MinimumExpanding.

Similar Threads

  1. Replies: 2
    Last Post: 9th August 2009, 22:08
  2. adding items in scroll area dynamically
    By Ezhil in forum Qt Programming
    Replies: 5
    Last Post: 22nd May 2009, 16:33
  3. Adding scroll bars to a main window
    By dougab in forum Newbie
    Replies: 9
    Last Post: 25th December 2007, 20:27
  4. minimizing main window
    By eric in forum Qt Programming
    Replies: 4
    Last Post: 28th November 2007, 16:54
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.