Results 1 to 3 of 3

Thread: Resizing QTableView inside a QTabWidget

  1. #1
    Join Date
    May 2010
    Location
    Somewhere in Southern Germany
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Resizing QTableView inside a QTabWidget

    I am using a QTableView to display results from an SQlite database. The QTableView is placed into the QTabWidget using the graphical editor in QtCreator. Layout is done using a grid.
    When I resize the main window, the QTabWidget will adjust its size but the QTableView inside will not. Both widgets use the "Expanding" size policy.

    However, when I place my QTableView directly on the main window using grid layout, resizing of the main window works fine, the tableview adjusts its size automagically.
    I seem to be missing some detail here. Can anyone please help how to get the qtableview resize automatically within the QTabWidget?

  2. #2
    Join Date
    May 2010
    Posts
    24
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resizing QTableView inside a QTabWidget

    Widgets outside layouts aren't resized automatically by their parent widget.
    You have to set a layout (it doesn't matter which type) inside each tab of the QTabWidget too.

  3. #3
    Join Date
    May 2010
    Location
    Somewhere in Southern Germany
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Resizing QTableView inside a QTabWidget

    Quote Originally Posted by alexisdm View Post
    Widgets outside layouts aren't resized automatically by their parent widget.
    You have to set a layout (it doesn't matter which type) inside each tab of the QTabWidget too.
    Thanks!!, this was the missing piece. I selected each tab and, using the context menu, set the layout to horizontal.. Now it works as expected.

Similar Threads

  1. Problem refreshing QTreeView inside QTabWidget
    By laugusti in forum Qt Programming
    Replies: 3
    Last Post: 16th December 2009, 09:05
  2. resizing widget inside QScrollArea
    By mastupristi in forum Newbie
    Replies: 4
    Last Post: 16th July 2009, 19:29
  3. Resizing QTableView
    By ghutchis in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 20:36
  4. Resizing a QTreeWidget inside a layout
    By bruccutler in forum Qt Programming
    Replies: 11
    Last Post: 27th March 2007, 15:35
  5. QTabWidget - problem with resizing
    By moowy in forum Qt Programming
    Replies: 5
    Last Post: 14th September 2006, 14:06

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.