Results 1 to 4 of 4

Thread: Crash in QTableWidget

  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    108
    Thanks
    9
    Thanked 12 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation Crash in QTableWidget

    Hi there,

    there seems to be a bug in the QTableWidget that causes a crash/access violation and can be reproduced as follows:

    - start editing a row in a QTableWidget
    - before leaving the editor, start a function that accesses the content of the table widget using the item() member function

    The crash occurred when editing a QTableWidget and saving (the save operation reads the data from the QTableWidget by retrieving QTableWidgetItems via the item() member function) while in the in-place editor was still active.

    A workaround is to first place the focus on a different widget to finish the editor and than start reading the content of the table widget.

    Is this a known bug?

    Bye,
    Andreas
    Andreas

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Crash in QTableWidget

    Could we see a minimal compilable example reproducing the problem?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crash in QTableWidget

    Does this crash always occur or only when you edit an empty cell?

  4. #4
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    108
    Thanks
    9
    Thanked 12 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Lightbulb Re: Crash in QTableWidget

    No, the crash always occurred when the editor was still active. But the good news is - while I was writing a demo program to reproduce the bug, I updated to Qt 4.3.2 and - surprise surprise - the crash no longer occurs (in 4.3.1 it still did)!

    So, that also answers my question whether this bug is already known :-)

    However, there is still a minor problem. Take a look at the attached test program that I wrote to illustrate what I was talking about.

    In Qt 4.3.1 using the save button works (because the focus is moved), using the ShortCut CTRL+S while editing causes a crash.

    Now, in Qt 4.3.2 the crash does no longer occur, but when the editor is still active the QTableWidget returns the _old_ value for the cell, since the editor hasn't "commited" the final edit value back (see debug output on console). So, the workaround with moving the focus away to finish all editors is still necessary.

    Bye,
    Andreas
    Attached Files Attached Files
    Andreas

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  2. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  3. QTableWidget (resizing rows, turning off selection, etc.)
    By kiss-o-matic in forum Qt Programming
    Replies: 6
    Last Post: 11th January 2007, 01:57
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.