Error in Qt Creator 5.9 ; use of deleted function 'Blob::Blob(const Blob&)'
-
I am currently dealing with these errors. I am not sure where I did wrong since they are from qobject.h
I am using Qt Creator 5.9 on Windows.The errors :
- C:\Qt\Qt5.9.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\ext\new_allocator.h:120: error: use of deleted function 'Blob::Blob(const Blob&)'
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^ - C:\Qt\Qt5.9.0\5.9\mingw53_32\include\QtCore\qscopedpointer.h:175: error: 'QScopedPointer<T, Cleanup>::QScopedPointer(const QScopedPointer<T, Cleanup>&) [with T = QObjectData; Cleanup = QScopedPointerDeleter<QObjectData>]' is private
Q_DISABLE_COPY(QScopedPointer)
^
- C:\Qt\Qt5.9.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\ext\new_allocator.h:120: error: use of deleted function 'Blob::Blob(const Blob&)'
-
Hi
It says use of deleted function
Blob::Blob(const Blob&)
In plain english it means "Hey you try to copy an QObject which is not allowed"
(the copy constructor have been deleted on purpose)So if Blob is a QObject, you somehow ask it to make a copy.
(inserting into list or by other means) -
I am currently dealing with these errors. I am not sure where I did wrong since they are from qobject.h
I am using Qt Creator 5.9 on Windows.The errors :
- C:\Qt\Qt5.9.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\ext\new_allocator.h:120: error: use of deleted function 'Blob::Blob(const Blob&)'
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^ - C:\Qt\Qt5.9.0\5.9\mingw53_32\include\QtCore\qscopedpointer.h:175: error: 'QScopedPointer<T, Cleanup>::QScopedPointer(const QScopedPointer<T, Cleanup>&) [with T = QObjectData; Cleanup = QScopedPointerDeleter<QObjectData>]' is private
Q_DISABLE_COPY(QScopedPointer)
^
- C:\Qt\Qt5.9.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\ext\new_allocator.h:120: error: use of deleted function 'Blob::Blob(const Blob&)'
-
Hi
It says use of deleted function
Blob::Blob(const Blob&)
In plain english it means "Hey you try to copy an QObject which is not allowed"
(the copy constructor have been deleted on purpose)So if Blob is a QObject, you somehow ask it to make a copy.
(inserting into list or by other means)@mrjj said in Error in Qt Creator 5.9 ; use of deleted function 'Blob::Blob(const Blob&)':
So if Blob is a QObject, you somehow ask it to make a copy.
(inserting into list or by other means)Does that mean that I can't append a class that inherits from QObject into a QVector? I kind of need to do that.
-
@mrjj said in Error in Qt Creator 5.9 ; use of deleted function 'Blob::Blob(const Blob&)':
So if Blob is a QObject, you somehow ask it to make a copy.
(inserting into list or by other means)Does that mean that I can't append a class that inherits from QObject into a QVector? I kind of need to do that.
-
@jsulm said in Error in Qt Creator 5.9 ; use of deleted function 'Blob::Blob(const Blob&)':
@m4l490n You can store pointers inside the vector
To slightly improve this answer:
You can store pointers to the QObject derived class inside the vector