title: Vector of custom classes
body: <p>I'm trying to create a vector of custom items that I have created but I encounter a very strange problem.</p>
  
  <p>When I create an instance of my class I don't have any problem but when I try to add it the vector I have a very long error and I don't know what to make of it.</p>
  
  <p>I don't know if it helps but the m_mesureList is a private attribute of the class PanneauMesure.</p>
  
  <p>Declaration in the .h:</p>
  
  <pre><code>std::vector&lt;Mesure&gt; m_mesureList;
  </code></pre>
  
  <p>Use:</p>
  
  <pre><code>void PanneauMesure::add(QPointF point1, QPointF point2, QPointF point3, QGraphicsItem *line1, QGraphicsItem *line2)
  {
      Mesure mesure(point1, point2, point3, line1, line2, this);
      //m_mesureList.push_back(mesure);
  }
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>In file included from ..\testQt\/PanneauMesure.h:21,
                   from ..\testQt\PanneauMesure.cpp:1:
  d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h: In copy constructor 'Mesure::Mesure(const Mesure&amp;)':
  ..\testQt\/Mesure.h:14:   instantiated from 'void __gnu_cxx::new_allocator&lt;_Tp&gt;::construct(_Tp*, const _Tp&amp;) [with _Tp = Mesure]'
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_vector.h:737:   instantiated from 'void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = Mesure, _Alloc = std::allocator&lt;Mesure&gt;]'
  ..\testQt\PanneauMesure.cpp:104:   instantiated from here
  d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h:806: error: 'QWidget::QWidget(const QWidget&amp;)' is private
  ..\testQt\/Mesure.h:14: error: within this context
  In file included from d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/mingw32/bits/c++allocator.h:34,
                   from d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/allocator.h:48,
                   from d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/string:43,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtCore/qstring.h:54,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtCore/qobject.h:48,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h:46,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/QWidget:1,
                   from ..\testQt\/PanneauMesure.h:4,
                   from ..\testQt\PanneauMesure.cpp:1:
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ext/new_allocator.h: In member function 'void __gnu_cxx::new_allocator&lt;_Tp&gt;::construct(_Tp*, const _Tp&amp;) [with _Tp = Mesure]':
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ext/new_allocator.h:105: note: synthesized method 'Mesure::Mesure(const Mesure&amp;)' first required here 
  In file included from ..\testQt\/PanneauMesure.h:21,
                   from ..\testQt\PanneauMesure.cpp:1:
  d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h: In member function 'Mesure&amp; Mesure::operator=(const Mesure&amp;)':
  ..\testQt\/Mesure.h:14:   instantiated from 'void std::vector&lt;_Tp, _Alloc&gt;::_M_insert_aux(__gnu_cxx::__normal_iterator&lt;typename std::_Vector_base&lt;_Tp, _Alloc&gt;::_Tp_alloc_type::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, const _Tp&amp;) [with _Tp = Mesure, _Alloc = std::allocator&lt;Mesure&gt;]'
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/stl_vector.h:741:   instantiated from 'void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&amp;) [with _Tp = Mesure, _Alloc = std::allocator&lt;Mesure&gt;]'
  ..\testQt\PanneauMesure.cpp:104:   instantiated from here
  d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h:806: error: 'QWidget&amp; QWidget::operator=(const QWidget&amp;)' is private
  ..\testQt\/Mesure.h:14: error: within this context
  In file included from d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/vector:69,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtCore/qvector.h:52,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtGui/qbrush.h:47,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtGui/qpalette.h:47,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/qwidget.h:49,
                   from d:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui/QWidget:1,
                   from ..\testQt\/PanneauMesure.h:4,
                   from ..\testQt\PanneauMesure.cpp:1:
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/vector.tcc: In member function 'void std::vector&lt;_Tp, _Alloc&gt;::_M_insert_aux(__gnu_cxx::__normal_iterator&lt;typename std::_Vector_base&lt;_Tp, _Alloc&gt;::_Tp_alloc_type::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, const _Tp&amp;) [with _Tp = Mesure, _Alloc = std::allocator&lt;Mesure&gt;]':
  d:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/vector.tcc:312: note: synthesized method 'Mesure&amp; Mesure::operator=(const Mesure&amp;)' first required here 
  </code></pre>
  
  <p>Edit, if it helps:</p>
  
  <p>Mesure.cpp:</p>
  
  <pre><code>Mesure::Mesure(QPointF point1, QPointF point2, QPointF point3, QGraphicsItem *line1, QGraphicsItem *line2, QWidget *parent):
      QWidget(parent),
      m_hlayoutMesure(new QHBoxLayout(this)),
      m_buttonClose(new QToolButton(this)),
      m_labelAngle(new QLabel(this)),
      m_checkboxMesure(new QCheckBox(this)),
      m_point1(point1),
      m_point2(point2),
      m_point3(point3),
      m_line1(line1),
      m_line2(line2),
      m_angle(0)
  {
      m_buttonClose-&gt;setText("X");
      m_labelAngle-&gt;setAlignment(Qt::AlignCenter);
      m_checkboxMesure-&gt;setChecked(true);
      m_hlayoutMesure-&gt;addWidget(m_checkboxMesure);
      m_hlayoutMesure-&gt;addWidget(m_labelAngle);
      m_hlayoutMesure-&gt;addWidget(m_buttonClose);
      m_hlayoutMesure-&gt;setSpacing(10);
      m_hlayoutMesure-&gt;setMargin(0);
      QObject::connect(m_buttonClose, SIGNAL(clicked()), this, SLOT(close()));
  }
  </code></pre>
  
  <p>PanneauMesure.cpp:</p>
  
  <pre><code>PanneauMesure::PanneauMesure(QWidget *parent) :
      QWidget(parent),
      m_vlayoutTotal(new QVBoxLayout(this)),
      m_groupboxMesures(new QGroupBox("Mesures", this)),
      m_vlayoutGroupBoxMesures(new QVBoxLayout(m_groupboxMesures)),
      m_scrollareaMesures(new QScrollArea(m_groupboxMesures)),
      m_widgetMesures(new QWidget(m_groupboxMesures)),
      m_hlayoutMesures(new QHBoxLayout(m_widgetMesures)),
      m_vlayoutMesures(new QVBoxLayout(m_widgetMesures)),
      m_groupboxOptions(new QGroupBox("Options", this)),
      m_vlayoutOptions(new QVBoxLayout(m_groupboxOptions)),
      m_buttonRAZ(new QPushButton("Remise à zéro", m_groupboxOptions)),
      m_widgetAlpha(new QWidget(m_groupboxOptions)),
      m_hlayoutAlpha(new QHBoxLayout(m_widgetAlpha)),
      m_labelAlphaText(new QLabel("Alpha :", m_groupboxOptions)),
      m_labelAlphaValeur(new QLabel("50", m_groupboxOptions)),
      m_sliderAlpha(new QSlider(m_groupboxOptions)),
      m_hlayoutCouleur(new QHBoxLayout(m_groupboxOptions)),
      m_labelCouleur(new QLabel("Couleur :", m_groupboxOptions)),
      m_buttonCouleur(new QToolButton(m_groupboxOptions)),
      m_couleur(Qt::yellow),
      m_hlayoutLongueur(new QHBoxLayout(m_groupboxOptions)),
      m_labelLongueur(new QLabel("Longueur :  ", m_groupboxOptions)),
      m_spinboxLongueur(new QSpinBox(m_groupboxOptions)),
      m_longueur(20),
      m_hlayoutLargeur(new QHBoxLayout(m_groupboxOptions)),
      m_labelLargeur(new QLabel("Largeur :", m_groupboxOptions)),
      m_spinboxLargeur(new QSpinBox(m_groupboxOptions)),
      m_largeur(5),
      m_mesureList()
  {
      // Alpha
      m_sliderAlpha-&gt;setMaximum(100);
      m_sliderAlpha-&gt;setValue(50);
      m_hlayoutAlpha-&gt;addWidget(m_labelAlphaText);
      m_hlayoutAlpha-&gt;addWidget(m_labelAlphaValeur);
      m_labelAlphaText-&gt;setAlignment(Qt::AlignRight);
      m_labelAlphaValeur-&gt;setAlignment(Qt::AlignLeft);
      m_sliderAlpha-&gt;setOrientation(Qt::Horizontal);
      QObject::connect(m_sliderAlpha, SIGNAL(valueChanged(int)), m_labelAlphaValeur, SLOT(setNum(int)));
  
      // Couleur
      QPixmap px(20, 20);
      px.fill(m_couleur);
      m_buttonCouleur-&gt;setIcon(px);
      m_hlayoutCouleur-&gt;addWidget(m_labelCouleur);
      m_hlayoutCouleur-&gt;addStretch(2);
      m_hlayoutCouleur-&gt;addWidget(m_buttonCouleur);
      m_hlayoutCouleur-&gt;addStretch(1);
      QObject::connect(m_buttonCouleur, SIGNAL(clicked()), this, SLOT(ouvrirCouleur()));
  
      // Longueur
      m_spinboxLongueur-&gt;setMinimum(1);
      m_spinboxLongueur-&gt;setValue(m_longueur);
      m_spinboxLongueur-&gt;setMaximum(999);
      m_hlayoutLongueur-&gt;addWidget(m_labelLongueur);
      m_hlayoutLongueur-&gt;addStretch(1);
      m_hlayoutLongueur-&gt;addWidget(m_spinboxLongueur);
      QObject::connect(m_spinboxLongueur, SIGNAL(valueChanged(int)), this, SLOT(sendParam()));
  
      // Largeur
      m_spinboxLargeur-&gt;setMinimum(1);
      m_spinboxLargeur-&gt;setMaximum(100);
      m_spinboxLargeur-&gt;setValue(m_largeur);
      m_hlayoutLargeur-&gt;addWidget(m_labelLargeur);
      m_hlayoutLargeur-&gt;addStretch(1);
      m_hlayoutLargeur-&gt;addWidget(m_spinboxLargeur);
      QObject::connect(m_spinboxLargeur, SIGNAL(valueChanged(int)), this, SLOT(sendParam()));
  
      // Options
      m_vlayoutOptions-&gt;addWidget(m_buttonRAZ);
      m_vlayoutOptions-&gt;addWidget(m_widgetAlpha);
      m_vlayoutOptions-&gt;addWidget(m_sliderAlpha);
      m_vlayoutOptions-&gt;addLayout((m_hlayoutCouleur));
      m_vlayoutOptions-&gt;addLayout((m_hlayoutLongueur));
      m_vlayoutOptions-&gt;addLayout((m_hlayoutLargeur));
      m_vlayoutOptions-&gt;setSpacing(0);
      QObject::connect(m_buttonRAZ, SIGNAL(clicked()), this, SLOT(remiseAZero()));
  
      // Mesures
      m_vlayoutMesures-&gt;addStretch(1);
      m_hlayoutMesures-&gt;addStretch(1);
      m_hlayoutMesures-&gt;addLayout(m_vlayoutMesures);
      m_hlayoutMesures-&gt;addStretch(1);
      m_widgetMesures-&gt;setLayout(m_hlayoutMesures);
      m_scrollareaMesures-&gt;setWidgetResizable(true);
      m_scrollareaMesures-&gt;setWidget(m_widgetMesures);
      m_scrollareaMesures-&gt;setFrameShape(QFrame::NoFrame);
      m_vlayoutGroupBoxMesures-&gt;addWidget(m_scrollareaMesures);
      m_vlayoutGroupBoxMesures-&gt;setMargin(0);
  
      // Total
      m_vlayoutTotal-&gt;addWidget(m_groupboxOptions);
      m_vlayoutTotal-&gt;addWidget(m_groupboxMesures);
  
  }
  
  void PanneauMesure::add(QPointF point1, QPointF point2, QPointF point3, QGraphicsItem *line1, QGraphicsItem *line2)
  {
      Mesure mesure(point1, point2, point3, line1, line2, this);
      m_mesureList.push_back(mesure);
      //m_vlayoutMesures-&gt;insertWidget(0, &amp;m_mesure);
      //QObject::connect(m_buttonRAZ, SIGNAL(clicked()), &amp;m_mesure, SLOT(close()));
  }
  
  void PanneauMesure::remiseAZero()
  {
      m_sliderAlpha-&gt;setValue(50);
      m_longueur = 20;
      m_spinboxLongueur-&gt;setValue(m_longueur);
      m_largeur = 5;
      m_spinboxLargeur-&gt;setValue(m_largeur);
      m_couleur = Qt::yellow;
      QPixmap px(20, 20);
      px.fill(m_couleur);
      m_buttonCouleur-&gt;setIcon(px);
      emit changementParam(m_couleur, m_longueur, m_largeur);
  }
  
  void PanneauMesure::ouvrirCouleur()
  {
      QColor color = QColorDialog::getColor(m_couleur);
      if (color.isValid()) m_couleur=color;
      QPixmap px(20, 20);
      px.fill(m_couleur);
      m_buttonCouleur-&gt;setIcon(px);
      emit changementParam(m_couleur, m_longueur, m_largeur);
  }
  
  void PanneauMesure::sendParam()
  {
      m_longueur = m_spinboxLongueur-&gt;value();
      m_largeur = m_spinboxLargeur-&gt;value();
      emit changementParam(m_couleur, m_longueur, m_largeur);
  }
  </code></pre>