cannot append QTextDocument to QList <QTextDocument>
-
I thought for any type a list can be created and values of this type appended to the list
But somehow it does not work for QTextDocument. Any hints how to achieve it?QList <QTextDocument> opis_wrapped_list;
QTextDocument opis_wrapped;
opis_wrapped.setTextWidth(width);opis_wrapped.setHtml("<p>"+opis_line+"</p>");
opis_wrapped_list.append(opis_wrapped);for the last line I get
/home/polrus/Dokumenty/inicio/inicio/inicio-common/ilabelprint.cpp:311: error: use of deleted function ‘QTextDocument::QTextDocument(const QTextDocument&)’ In file included from /usr/include/qt5/QtCore/qhash.h:46, from /usr/include/qt5/QtCore/qdebug.h:45: /usr/include/qt5/QtCore/qlist.h: In instantiation of ‘void QList<T>::node_construct(Node*, const T&) [with T = QTextDocument]’: /usr/include/qt5/QtCore/qlist.h:625:13: required from ‘void QList<T>::append(const T&) [with T = QTextDocument]’ ../inicio-common/ilabelprint.cpp:311:37: required from here /usr/include/qt5/QtCore/qlist.h:465:65: error: use of deleted function ‘QTextDocument::QTextDocument(const QTextDocument&)’ 465 | if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t); | ^~~~~~~~ -
QList<T> requires that type T is an assignable data type.
QTextDocument is a QObject and you cannot copy QObjects (by design).Store a pointer instead
QList<QTextDocument *> list