Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Copy & paste for UserTextObjects in QTextEdit



  • Hi.
    I work on a QTextEdit with some self created TextObjects. The TextObjects containing some QImages. I know that normaly "copy & past" don't funktion with self created TextObjects. So I reimplemented the createMimeDataFromSelection(). In this Methode I replace my TextObjects with a normal QTextImageFormat, let QTextEdit creat my QMimeData and switch the Images back. Additional I write my QImage in an QTemoraryFile, so that other Programms like maybe MSWord could read the MimeData.

    Okay, now my questions:

    • Are there a better way to implement the "copy & paste"-functionality for UserTextObjects or a better way to creat the MimeData?
    • Is there an other way to transfer the Images through the Clipboard without temporary Files?

Log in to reply