Results 1 to 1 of 1

Thread: Problem refreshing the contents of a QTable [Qt 3.3.8]

  1. #1
    Join Date
    Mar 2006
    Posts
    56
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Problem refreshing the contents of a QTable [Qt 3.3.8]

    Hi all,

    I have a problem refreshing the content of a QTable.
    I'm simply creating a table with a few rows and columns. The last column contains QToolButtons for each row.

    The problem is that the first time the table is shown, if the last column is not visible, then the tool buttons in such column are visible but in a wrong position. If I scroll to the right the view then the tool buttons are put in the correct position. (see the attached images)

    It seems a contents refresh problem. But I'm not sure.

    This is the code I'm using:

    Qt Code:
    1. MyTable::MyTable(QWidget * parent, const char * name)
    2. : QTable(parent, name)
    3. {
    4. verticalHeader()->hide();
    5. setLeftMargin(0);
    6.  
    7. setNumCols(4);
    8. QStringList columnNames;
    9. columnNames << "Variable Name";
    10. columnNames << "Variable Value";
    11. columnNames << "Variable Description";
    12. columnNames << "";
    13. setColumnLabels(columnNames);
    14. }
    15.  
    16. void MyTable::setVariablesList( const MyVar &varsList )
    17. {
    18. setNumRows( varsList.count() );
    19.  
    20. QToolButton *pButton;
    21. MyEditor *pVarEditor;
    22. QValueList<MyVar>::const_iterator it = varsList.begin();
    23. int i = 0;
    24. for( ; it != varsList.end(); it++, i++ )
    25. {
    26. pVarEditor = MyVarEditorFactory::create(this, *it);
    27. pButton = new QToolButton(this);
    28.  
    29. setText(i, 0, (*it).sName);
    30. setText(i, 1, (*it).sDescription);
    31. setCellWidget(i, 2, dynamic_cast<QWidget *>(pVarEditor) );
    32. setCellWidget(i, 3, pButton);
    33. }
    34.  
    35. for( int i = 0; i < numCols(); i++ )
    36. adjustColumn(i);
    37. }
    To copy to clipboard, switch view to plain text mode 


    I would be very glad if you can help me solving such problems.
    Thanks a lot in advance!
    Attached Images Attached Images

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
  •  
Qt is a trademark of The Qt Company.