Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cannot append QTextDocument to QList <QTextDocument>
Forum Updated to NodeBB v4.3 + New Features

cannot append QTextDocument to QList <QTextDocument>

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 201 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Seb TurS Offline
    Seb TurS Offline
    Seb Tur
    wrote on last edited by
    #1

    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);
          |                                                                 ^~~~~~~~
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      5

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved