God day to you my fellow programmers.

I have a little problem when using two different QVector objects. One is declared as
Qt Code:
  1. QVector<QDSWireObject*> m_wireVector;
To copy to clipboard, switch view to plain text mode 
.
The other one is declared as
Qt Code:
  1. QVector< QVector<QDSWireObject*> > m_vectorVector;
To copy to clipboard, switch view to plain text mode 
.

And now i have two different functions which is
Qt Code:
  1. void QDSMainWindow::deleteWire(QDSWireObject *wire)
  2. {
  3. QVector<QDSWireObject*> objectVector = findObjectVector(wire);
  4.  
  5. if(!objectVector.isEmpty())
  6. {
  7. Q_FOREACH(QDSWireObject* item, objectVector)
  8. {
  9. if(item == wire)
  10. {
  11. int index = objectVector.indexOf(wire);
  12.  
  13. if(item->getConnectedBefore())
  14. objectVector.at(index - 1)->setConnectedAfter(0);
  15.  
  16. if(item->getConnectedAfter())
  17. objectVector.at(index +1 )->setConnectedBefore(0);
  18.  
  19. item->deleteLater();
  20. objectVector.remove(objectVector.indexOf(item));
  21. qDebug() << objectVector.size();
  22. }
  23. }
  24. }
  25. }
To copy to clipboard, switch view to plain text mode 
This function makes a call to this other function that I am using

Qt Code:
  1. const QVector<QDSWireObject*>& QDSMainWindow::findObjectVector(QDSWireObject *wire)
  2. {
  3. Q_FOREACH(QVector<QDSWireObject*> item, m_vectorVector)
  4. {
  5. if(item.contains(wire))
  6. {
  7. int index = m_vectorVector.indexOf(item);
  8. return m_vectorVector.at(index);
  9. }
  10. }
  11.  
  12. return QVector<QDSWireObject*>();
  13. }
To copy to clipboard, switch view to plain text mode 

And now problem here is that the QVector that the findObjectVector() function returns seems to be a copy of the one from the stored in m_vectorVector. Because when i remove an element it gets removed from the vector and the size changes but if I make several calls to the function I can tell that the vector size of the vector stored in m_vectorVector is not changing. Which I don't really understand why because I am returning a reference to the object.

Hopefully someone can help me out here and see what my problem is.