Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segmentation Fault in Qtablewidget
Forum Updated to NodeBB v4.3 + New Features

Segmentation Fault in Qtablewidget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    petergollapalli
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi!
      How do you write and read data from cells? Can you give some code?
      And did you look at documentation?
      "QTableWidget":http://qt-project.org/doc/qt-4.8/qtablewidget.html
      "How to Use QTableWidget":http://qt-project.org/wiki/How_to_Use_QTableWidget

      1 Reply Last reply
      0
      • P Offline
        P Offline
        petergollapalli
        wrote on last edited by
        #3

        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
        if(!Text.isEmpty())

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SetBetterPass
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved