Insert emoji in QT QTextEdit

I am trying to insert emoji into the QT QTextEdit field, but it is not recognized and displayed as ??? or [] []

I'm not talking about a smiley face, I'm talking about emoji.

How can I make sure QT QTextEdit accepts emoji and displays them correctly?

Thank.

Got it based on a helpful answer below:

DECISION:

    QFontDatabase fontDB;
    fontDB.addApplicationFont(":/Resources/fonts/seguisym.ttf");

    QApplication::setFont(QFont(QStringLiteral("Segoe UI Symbol")));
+4
source share
2 answers

A significant number of emoji characters are found in Unicode Standard . If you, for example, work with Qt 5.3 on Mac OS X 10.9, inserting emoji characters in text editors, they should work just like when pasting any other character.

, ? / [], , (, ) emoji ". . .

Qt

QFontDatabase fontDB;
fontDB.addApplicationFont(":/A Font Supporting Emoji.ttf");

QTextEdit,

setFont(QFont(QStringLiteral("A Font Supporting Emoji")));

emoji.

+3

Qt QTextEdit:: paste() : 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.

, . HTML img, , ressource ( ).

0

All Articles