How to programmatically set row in a QStringListModel?
-
Hi -
I have a QStringListModel that is used by a QComboBox to represent the current state of an object. This state can be changed by the user (using the QComboBox) but it can also change remotely. When it does, my program is informed with a message. I can get the value of the new state, but I don't know what to do with it. It seems like I'd want a setRow() command for the model, but I don't see anything like that. Can someone shed some light on this for me?
Thanks...
-
Hi,
That's something you do at the combo box level. The model itself doesn't know anything about selection. Use QComboBox::setCurrentIndex with the value returned by QComboBox::findText.
-
You're welcome !
It's the same as for everything: practice and practice again and it will come :)