Results 1 to 2 of 2

Thread: Resizing QMainWindow according to QTableWidget size

  1. #1
    Join Date
    Jan 2012
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Resizing QMainWindow according to QTableWidget size

    Hi, i have a QMainWindow's central widget with QHBoxLayout, which contains 2 frames. Left frame is a QVBoxLayout with some buttons etc. Right frame is also a QVBoxLayout, but it contains a QTableWidget, that can represent tables with different numbers of columns and rows. I am trying to make QMainWindow to resize according to left + right frames' width and height.

    I subclassed QTableWidget, setted its sizepolicies to (Minimum,Minimum), reimplemented its sizehint method. I also setted left and right frames' sizepolicies to (maximum, preferred). I use resize() to mainwindow with slot method where i calculate both frames' widths. So it works fine, but if QTableWidget becomes too large to fit the screen, i can't shrink the mainwindow, because of QTableWidget setted sizepolicies (Minimum,Minimum). With other sizepolicies it doesn't work at all - right frame doesn't grow and mainwindow has a size of left frame.

    How can i solve my problem? Or may be there is another more appropriate solution? Thanks for help.

  2. #2
    Join Date
    Jan 2012
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Re: Resizing QMainWindow according to QTableWidget size

    Well, solved my problem by limiting x and y sizes in QTableWidget sizeHint() , but still this sizepolicies aren't clear for me...

Similar Threads

  1. Resizing QML and QMainWindow
    By hungarycoder in forum Qt Quick
    Replies: 3
    Last Post: 19th February 2011, 18:12
  2. unwanted QDockWidget resizing after QMainWindow::tabify()
    By alpinista in forum Qt Programming
    Replies: 0
    Last Post: 12th January 2011, 06:56
  3. Replies: 2
    Last Post: 23rd March 2009, 17:26
  4. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08:16
  5. Prevent from resizing a QMainWindow
    By Flier in forum Qt Tools
    Replies: 5
    Last Post: 14th April 2006, 17:11

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.