Results 1 to 4 of 4

Thread: QTableWidget in a QTreeWidget problem

  1. #1
    Join Date
    Jun 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTableWidget in a QTreeWidget problem

    Hi!

    I'm setting a QTableWidget in a QTreeWidget, but the size of the table is the size of the cell of the tree (i.e. is too small) and the table doesn't fit, so i put the minimumHeight to the tableWidget bigger, now it appears but it appears on top of the other cells in the tree .
    Here is the code

    Qt Code:
    1. TableStruct t = ::getTable();
    2.  
    3. QTableWidget* tableWidget = new QTableWidget;
    4. tableWidget->setRowCount(t.getRowCount()); tableWidget->setColumnCount(t.getColumnCount());
    5. tableWidget->setHorizontalHeaderLabels(t.getColumnNames().toList());
    6.  
    7. QVector data = t.getData();
    8. int i = 0;
    9. for( int row = 0; row < t.getRowCount(); ++row)
    10. for( int col = 0; col < t.getColumnCount(); ++col, ++i )
    11. tableWidget->setItem(row,col,new QTableWidgetItem(data.at(i)));
    12.  
    13. ui.treeWidget->setItemWidget(item,1,tableWidget);
    To copy to clipboard, switch view to plain text mode 

    I looks like this:
    snap01.jpg

    Now if i add
    Qt Code:
    1. tableWidget->setMinimumHeight(50*t.getRowCount());
    To copy to clipboard, switch view to plain text mode 

    It looks like:
    snap02.jpg

    Any help.

    thanks.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableWidget in a QTreeWidget problem

    What do you expect if you have not adjusted the height of the QTreeWidget row the table is inserted into?

  3. #3
    Join Date
    Jun 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableWidget in a QTreeWidget problem

    It is adjusted.

    I'm using proxys, it might be for that.

  4. #4
    Join Date
    Jun 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableWidget in a QTreeWidget problem

    are you asking? or telling me? could you be more helpfull?
    thanks!

Similar Threads

  1. Replies: 1
    Last Post: 20th April 2012, 08:09
  2. Replies: 0
    Last Post: 6th May 2011, 07:28
  3. Replies: 3
    Last Post: 9th December 2010, 21:10
  4. Replies: 2
    Last Post: 8th October 2010, 17:12
  5. Replies: 3
    Last Post: 22nd March 2010, 13:50

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.