Important: Please read the Qt Code of Conduct -

Segmentation Fault in Qtablewidget

  • hi Every one Iam new to Qt
    I am facing a problem of Segmentation due to which My application is stoping

    In my application Iam having a QtableWidget
    with 4 columns per Row and iam Adding Rows Dynamically

    What my problem is Iam saving the data of Qtablewidget(i.e) Data in the cells of Qtablewidget
    Some of my cells may have empty data
    if No data in any columns it stoping the application
    how to over come this problem
    can any one helps in this?
    Thanks in Advance

  • Hi!
    How do you write and read data from cells? Can you give some code?
    And did you look at documentation?
    "How to Use QTableWidget":

  • Hi qxoz,
    Thanks for reply

    I am directly writing the Data in the cell i.e(through keyboard)

    and i am Reading the Data By Using Code:
    QString Text =ui->tableWidget->item(row,4)->text();

    and I am Checking Whether Text is empty or not

  • It seems row variable is at one point out of range, probably higher than row count, you should check why is this happening and add something like
    if(table->rowCount()<=row)return;//or break if its loop
    I am not sure if there is such function, if not just save row count as you create table in some int var.

Log in to reply