how can i save and open (write saved file) data in a table widget

  • Hi all,

    I have built a QTableWidget that the user fills table by using combo box & spin delegates, and a menu named as file with open,save,clear & exit .
    here clear and exit options in menu are working fine but I cannot find how to SAVE & OPEN the data of a table .

    Could you point me in the right direction. I will continue trying to find an example in the meantime!


  • Qt Champions 2017

    What do you plan to save?
    the texts?

    This post has save & load function.

  • @mrjj but in that save is working when in make this command as a comment
    strList <<
    "" " +
    ui->textEdit->toPlainText().toUtf8() +
    "" ";

    but coming to load it is showing an error
    " Unhandled exception at 0x52061aad (QtGuid4.dll) in tablewidget with delegates.exe: 0xC0000005: Access violation reading location 0x0000000000000000."

    with break load ignore options

    don't know what to do

  • Qt Champions 2017

    You must debug it.
    Place break point at load function and find the line
    where you crash by single step through the code.

    From the error
    Access violation reading location 0x0000000000000000."

    Seems like a dangling pointer to me.

  • @mrjj

    i replace this line
    ui->tableWidget->setItem(x-1,y,new QTableWidgetItem(rowData[y]));
    loading is working fine now thanks problem solved

Log in to reply

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