title: QComboBox with custom model
body: <p>I have a custom storage and I want to implement <code>ListModel</code> to display it with <code>QComboBox</code>. For simplicity let's assume that we have a list of <code>int</code> as a model's data, so here is my implementation of a model and test program:</p>
  
  <pre><code>#include &lt;QApplication&gt; 
  #include &lt;QDebug&gt;
  #include &lt;QAbstractListModel&gt;
  #include &lt;QComboBox&gt;
  #include &lt;QHBoxLayout&gt;
  #include &lt;QPushButton&gt;
  
  QList&lt;int&gt; list;
  
  class MyModel : public QAbstractListModel
  {
  public:
      MyModel( QWidget* parent ):
          QAbstractListModel( parent )
      {}
      ~MyModel()
      {
          qDebug() &lt;&lt; __FUNCTION__;
      }
  
      QVariant data(const QModelIndex &amp;index, int role) const
      {
          if ( !index.isValid() )
              return QVariant();
  
          if ( ( role == Qt::DisplayRole ) &amp;&amp; ( index.row() &lt; list.size() ) )
              return QString::number( list.at( index.row() ) );
  
          return QVariant();
      }
  
      int rowCount(const QModelIndex &amp;parent) const
      {
          Q_UNUSED( parent )
          return list.size();
      }
  };
  
  int main ( int argc, char* argv[] )
  {
      QApplication app ( argc, argv );
  
      QWidget w;
      QHBoxLayout* l = new QHBoxLayout();
  
      QComboBox* c = new QComboBox( &amp;w );
      c-&gt;setModel( new MyModel( c ) );
      l-&gt;addWidget( c );
  
      QPushButton* b = new QPushButton("+");
      QObject::connect( b, &amp;QPushButton::clicked, [](){
          list.push_back( qrand() );
          qDebug() &lt;&lt; list;
      } );
      l-&gt;addWidget( b );
  
      b = new QPushButton("-");
      QObject::connect( b, &amp;QPushButton::clicked, [](){
          if ( !list.isEmpty() )
              list.pop_back();
          qDebug() &lt;&lt; list;
      } );
      l-&gt;addWidget( b );
      w.setLayout( l );
      w.show();
  
      return app.exec ();
  }
  </code></pre>
  
  <p>If I hit <strong>button Add</strong> only once and then check list, it looks okay, but when I hit it again, <code>QComboBox</code> displays only the first value and an empty line; continuing adding new elements has no effect at <code>QComboBox</code>.
  If I click on <strong>button Add</strong> many times, then I can see the correct list in <code>ComboBox</code>.</p>
  
  <p>I can't understand what is going on and what I do wrong.</p>
  
  <p>I am using <code>Qt5.5.1</code> with <code>VS2013 x32</code> on <code>Windows 7</code>.</p>