Get indices of rows where the signal dataChanged() was emitted
Hello all,
I have a model displaying data in a tree view. I implemented a proxy model to show some categories of the tree view in a table view. On my table view, I have on each column different types of items (QComboBox, 3 x QDoubleSpinBox and a QCheckBox). I'm plotting various curves depending on the data in my Table. I'm plotting data stored in the rows and to be able to update my plot, I will like to react to changes in the combo box, the spin boxes and the check box.
Is there a way to catch the row where a signal whas a emitted or do I need to write a slot that react to the signals
currentIndexChanged, valueChanged and stateChanged.
Thanks for your hints,
Yann
Re: Get indices of rows where the signal dataChanged() was emitted
How did you put those widgets there?
Re: Get indices of rows where the signal dataChanged() was emitted
I'm using a custom delegate that inherits QStyledItemDelegate.
Edit: Your question let me think a bit. Actually I'm using the same delegate between the tree view and the table view since I'm sharing the same model between both views. Wouldn't it be easier to implement a second delegate for the table view and emit myself the signal commitData?
Re: Get indices of rows where the signal dataChanged() was emitted
Using QStyledItemDelegate doesn't explain how you put widgets inside item cells. Did you implement all functionality of the widgets yourself or have you used real widgets? If the former then there are no signals there as there are no widgets to emit them. If the latter then I repeat my question -- how did you put those widgets there.
Re: Get indices of rows where the signal dataChanged() was emitted
If by real widgets you mean the Qt widgets, I'm just reimplementing the createEditor method and setting my widget at the specified index.
Re: Get indices of rows where the signal dataChanged() was emitted
You mean you createEditor returns a QWidget that has e.g. three double spin boxes inside, etc., yes?
If so then your editor widget (the "top level" widget you return) should expose one or more properties that will be used in setModelData() and setEditorData() to sync the editor and the model. Qt will be able to handle standard property types by itself (assuming the property is marked as a USER property), for non-standard you have to reimplement setModelData and setEditorData and do the syncing yourself.
Re: Get indices of rows where the signal dataChanged() was emitted
I already reimplemented setModelData and setEditorData. I made a basic mistake by handling of the dataChanged() signal that I was invoking like instead of .