Qt World Summit: Register Today!

[Solved]SIGSEGV after delete QComboBox

  • I have a QDialog, where I have QTableView and throug method setIndexWidget I am inserting there QComboBoxes, but after I delete QComboBox and close dialog through this->close or i want to sort the table, it crash in SIGSEGV... now i dont know what to do

  • Read the documentation to setIndexWidget. It says:
    Sets the given widget on the item at the given index, passing the ownership of the widget to the viewport.
    So you're not allowed to delete it yourself but only by calling setIndexWidget again with another widget (or probably 0).

    Are you sure you want setIndexWidget and not QStyledItemDelegate?

  • Thank you, its working kow, but know i have the problem with setIndexWidget in otehr place, because I'm setting it too many times, and it is very slow, do you think that QStyledItemDelegate will be quicker?

  • Yes, probably. QStyledItemDelegate might be the correct thing to use anyhow, in your case, but you haven't said much about your application.

Log in to reply