Results 1 to 20 of 23

Thread: QTableWidget Not expanding to size of QDockWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QTableWidget Not expanding to size of QDockWidget

    Hello all,

    I am running into an issue with a QTableWidget not expanding to the size of the QDockWidget it is being created inside of. I am not specifying a layout. I have tried implementing minimumSizeHint() and sizeHint() in the QTableWidget derived class. It is called once upon startup but never again when I insert columns in my table. I have tried calling it explicitly after a column insertion but it doesn't make a difference in the size. I tried force executing updateGeometry() as well, again to no avail.

    This first picture shows what it looks like when my app loads. As you see the table in the "Output" is not expanded to the extent of the QDockWidget.
    output1.jpg

    This one shows what happens when I insert a column.
    output2.jpg

    How do I get this to work as I want it to?

    Cheers!
    -Caolan.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget Not expanding to size of QDockWidget

    Is the table widget the one you set with QDockWidget::setTableWidget?

    Cheers,
    _

  3. #3
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QTableWidget Not expanding to size of QDockWidget

    Yes it is. And it's a QTableView, not widget...

    Qt Code:
    1. pDock = new QDockWidget(tr("Output"), this);
    2. m_pPhysEqSolver = new PhysEqSolver(1, 2, pDock);
    3. pDock -> setWidget(m_pPhysEqSolver);
    4. pDock -> setAllowedAreas(Qt::BottomDockWidgetArea);
    5. addDockWidget(Qt::BottomDockWidgetArea, pDock);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. class PhysEqSolver : public QTableView {
    2. Q_OBJECT
    3. public:
    4. PhysEqSolver(int rows = 0, int cols = 1, QWidget * = NULL);
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget Not expanding to size of QDockWidget

    Hmm, ok.

    Try setting the size policy of PhysEqSolver to Expanding in both directions.

    Cheers,
    _

Similar Threads

  1. Layout Expanding Font Size
    By Henry Blue Heeler in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2015, 06:55
  2. Replies: 2
    Last Post: 3rd January 2015, 05:48
  3. Dealing with Layout expanding size
    By edxxgardo in forum Qt Programming
    Replies: 2
    Last Post: 16th August 2011, 10:20
  4. Replies: 1
    Last Post: 20th May 2011, 17:36
  5. Expanding QToolButton size
    By kodiak in forum Qt Programming
    Replies: 2
    Last Post: 4th June 2009, 07:17

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.