QTableView set mapper current index on row click
-
Hi,
QDataWidgetMapper::setCurrentModelIndex looks like a better option.
See the sample code from the function's documentation. It looks like what you might be trying to accomplish.
Hope it helps
-
AFAIK, you can't do it like that. The QDataWidgetMapper won't change anything if you path an invalid index value.
If you want it empty, you're likely going to have to reset the mappings.
However that doesn't sound clean, why do you need it to be in such an "invalid" state ?
-
I have a combo, a table, and a textbox.
TextBox is mapped to a field by the mapper.I select an option from the combo, the table gets refreshed with new records, depending on the option selected in the combo.
I click on a row in the table, and mapper 's current index goes to the selected record(with the code you suggested).
So the textbox gets the appropriate data.I select another option from the combo, the table gets refreshed.
I have not, yet, clicked on the table, no row is selected.
But the textbox still has the same content.
I want it to be empty.