Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. ios emoji unicode
Qt 6.11 is out! See what's new in the release blog

ios emoji unicode

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 1.1k 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.
  • L Offline
    L Offline
    liweian
    wrote on last edited by
    #1

    I failed to get the emoji work on ios and hope someone could offer some suggestion.

    I store emoji's unicode, utf8, utf16, image file name in sqlite and query data by QSqlQueryModel. Since the qml add emoji like this on ios: text{text:"\uD83D\uDCA9"}, i write the following code to convert emoji's utf16 just like that format.

    @QByteArray SqlQueryModel::convertStringTest(QString qString)
    {
    qDebug() << qString;
    QString result = qString;
    QStringList qStringList = qString.split("0x", QString::SkipEmptyParts);
    if(qStringList.size() >= 2)
    {
    result = "\u" + qStringList[0].trimmed() + "\u" + qStringList[1];
    }
    else
    result = "\u" + qStringList[0];
    qDebug() << result; //the result is "\uD83D\uDCA9"

    return result;
    

    }

    in qml, i call the function as:
    @text
    {
    text: emojiListModel.convertStringTest(utf16); // the utf16's value is "0xD83D 0xDE04" with a database format of TEXT
    }@

    The it is always display "\uD83D\uDCA9" on ipad but not the emoji. Then i add console.log to print the result of emojiListModel.convertStringTest(utf16) in qml.

    @function test(utf16str)
    {
    var str1 = utf16str; //value is "\uD83D\uDCA9"
    var str2 = "\uD83D\uDCA9";
    console.log(str1); //display string "\uD83D\uDCA9"
    console.log(str2); //display emoji

        return str1;
    }@
    

    I have no idea why this not work?

    1 Reply Last reply
    0

    • Login

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