qt model/view set current object
<p>I have a QComboBox showing data from a QAbstractListModel (sample code below).</p>

<pre><code>class Object {};

class ModelObject : public QAbstractListModel {
  //Implementation of model showing vector&lt;Object&gt;
};

vector&lt; Object &gt; objects;
ModelObject model(objects);
QComboBox* combo_box = new QComboBox(parent);
combo_box-&gt;setModel(model);
</code></pre>

<p>I would like to have a way to show a given object in the combo box. Currently, I iterate on each index in the model, and when I find the object I want to show, I call "combo_box->setCurrentIndex". However, it seems a bad design to me.</p>

<p>Any suggestion to do this better ?</p>

<p>Edit: the object I want to show comes from a reference elsewhere (eg: aggregated in an other object).</p>