Pasting emoji in QT QTextEdit

前端 未结 2 1495
终归单人心
终归单人心 2021-02-09 23:31

I\'m trying to paste emoji\'s in the QT QTextEdit box but it\'s not getting recognized and it\'s showing as ??? or [][]

I\'m not talking about smiley, I\'m talking about

2条回答
  •  我寻月下人不归
    2021-02-09 23:59

    The Qt documentation of QTextEdit::paste() says: To change the behavior of this function, i.e. to modify what QTextEdit can paste and how it is being pasted, reimplement the virtual canInsertFromMimeData() and insertFromMimeData() functions.

    There you should be able to convert the pasted data e.g. to an HTML img element pointing to a file that is embedded into the application by ressource compiler (or to image file on disk).

提交回复
热议问题