Results 1 to 3 of 3

Thread: Exporting Qtablewidget to CSV..Segmentation fault after some values

  1. #1
    Join Date
    May 2012
    Posts
    33
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Exporting Qtablewidget to CSV..Segmentation fault after some values

    Hi. I have a qtabewidget which has 10 rows and 2000 columns. When I save it to CSV after saving some rows(around 1500) its saying segmentation fault...Whats wrong with the code...
    Qt Code:
    1. void Read_Table::on_to_CSV_clicked()
    2. {
    3. QFile f( "save1.csv" );
    4.  
    5. if (f.open(QFile::WriteOnly))
    6. {
    7. QTextStream data( &f );
    8. QStringList strList;
    9. strList.clear();
    10.  
    11. for( int c = 0; c < ui->O_Table->columnCount(); ++c )
    12. {
    13. // strList << "\" "+ui->O_Table->item( r, c )->text()+"\" ";
    14. strList <<
    15. "\" " +
    16. ui->O_Table->horizontalHeaderItem(c)->data(Qt::DisplayRole).toString() +
    17. "\" ";
    18.  
    19.  
    20. }
    21. data << strList.join( ";" )+"\n";
    22. for( int r = 0; r < ui->O_Table->rowCount(); ++r )
    23. {
    24. strList.clear();
    25. for( int c = 0; c < ui->O_Table->columnCount(); ++c )
    26. {
    27. strList << "\" "+ui->O_Table->item( r, c )->text()+"\" ";
    28.  
    29.  
    30. }
    31. data << strList.join( ";" )+"\n";
    32. }
    33. f.close();
    34. }
    35.  
    36. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Exporting Qtablewidget to CSV..Segmentation fault after some values

    Run a debugger.

  3. #3
    Join Date
    May 2012
    Posts
    33
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Exporting Qtablewidget to CSV..Segmentation fault after some values

    issue resolved...
    I set all rows to null before inserting the data in to qtablewidget...

Similar Threads

  1. Replies: 5
    Last Post: 17th January 2012, 23:12
  2. a segmentation fault
    By yaohao@qtcentre in forum Qt Programming
    Replies: 4
    Last Post: 17th March 2011, 10:01
  3. Segmentation fault
    By Schimanski in forum Qt Programming
    Replies: 20
    Last Post: 31st August 2009, 17:26
  4. segmentation fault
    By dreamer in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2008, 08:48
  5. Replies: 2
    Last Post: 25th March 2006, 07:54

Tags for this Thread

Bookmarks

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.