Results 1 to 3 of 3

Thread: Automatic sizing of QTableWidget's cells

  1. #1
    Join Date
    Sep 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Automatic sizing of QTableWidget's cells

    I try to create the QTableWidget with the number of columns and rows specified at the moment of creation and then populate its cells with widgets using setCellWidget().

    It works except for one moment: the widget is resized to fit the cell. I tried setting the widget's minimal size, but it resulted in a really bad outcome: the cell size remained the same, and widgets started overlapping, creating a total mess in the table.

    Is there a way to make Qt set the height of rows and width of columns so that the biggest widget fits well?

  2. #2
    Join Date
    Aug 2006
    Posts
    15
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Automatic sizing of QTableWidget's cells

    You can try checking the sizeHint of all the cells, and with this set the minimum size of both the columns and rows

  3. #3
    Join Date
    Sep 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Automatic sizing of QTableWidget's cells

    I found the solution: the QTableView has resize{Rows,Columns}ToContents() functions.

    I should read mans more attentively .

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.