Results 1 to 2 of 2

Thread: QT crashes when trying to insert data into QTableWidgets

  1. #1
    Join Date
    Nov 2012
    Qt products

    Exclamation QT crashes when trying to insert data into QTableWidgets

    I have noticed a particularly weird feature when using QTableWidgets and I'm hoping there is an easy work-around or that I am missing something easy. Often times after creating new tables, QT will crash when you try to run a build where you insert information into the Table. One way to fix this is to double click on the table, go the "items" tab, click "properties" at the lower right, and make sure that each cell has a property where the word "text" is BOLD. If the word text is not bold, that cell will not accept data and it will cause a crash. So say you have a table that is 5 X5, that means you have to make sure that 25 cells have the word "text" bold before it will work properly. To make this "text" turn bold you must double click into each cell. It turns from regular to bold right then and the next time you run it will work properly (assuming you got all 25 cells, if you only get 24, crash). Is this a bug? Or is there a setting I am missing?

    I have a table that has 10 rows and 1000 columns, I don't think I want to click 20,000 (10,000 cells each double clicked) times in order for my table to accept data....any ideas?

    attached is a pic to help any confusion, its a hard issue to describe. Notice in the right section at the top how the word "text" is bold, and nothing else is. This is achieved by double clicking into the cell, prior it would have been regular and not bold. If I do not do this for each cell my build will crash. Even if I have to update only 1 cell, if ALL cells aren't fixed it will crash. ITEMWEIRD.jpg

    the quantum mechanic

  2. #2
    Join Date
    Feb 2008
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5

    Default Re: QT crashes when trying to insert data into QTableWidgets

    When you add columns or rows to a QTableWidget in designer the cells are empty. I assume your program is crashing where you are doing some processing. If that is the case check to see if the cell has an item in it:
    Qt Code:
    1. if( QTableWidget::item(row, column) != 0 )
    2. //do something
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. SOLVED : SqlQuery can't insert data.
    By naptizaN in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2012, 13:32
  2. Getting / setting data on QTableWidgets
    By orfner in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2011, 02:33
  3. Replies: 5
    Last Post: 10th June 2011, 10:58
  4. Insert data to QTableView
    By Lodhart in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2009, 09:38
  5. insert additional data into qdirmodel
    By killerwookie99 in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2008, 15:09

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.