[SOLVED] Error with QTableViewWidget



  • Hi,
    !http://kepfeltoltes.hu/120725/qt4_www.kepfeltoltes.hu_.png(qt)!
    I use @ui->tableWidget->clear ();@ but, my table size is increasing.
    In the FOR I use @ui->tableWidget->insertRow(i);@
    What's the problem?



  • Its too far to analyse the problem unless you provide some more lines of code.



  • Hi there,
    What might be the problem (if you are really using the model/view with the QTableView) is that the model controls all the column and row information. Not the View itself. I think you have the QTableWidget instead.
    The clear() function will not resize the number of rows/columns etc!! Stated in the documentation.

    void QTableWidget::clear () [slot]

    Removes all items in the view. This will also remove all selections. The table dimensions stay the same.
    Use the setColumnCount function to delete any unwanted columns. The used items / widgets in the deleted rows are unallocated automatic in the latest libs of Qt, so don't worry about memory leaks.
    Hope this helps, otherwise supply more code!



  • [quote author="Jeroentje@home" date="1343207543"]
    Use the setColumnCount function to delete any unwanted columns. The used items / widgets in the deleted rows are unallocated automatic in the latest libs of Qt, so don't worry about memory leaks.
    Hope this helps, otherwise supply more code!
    [/quote]

    Thanks, Jeroentje@home
    You solved my problem. :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.