QML custom TextField & Emoji



  • Hello! I've got a next issue: drawing of the Emoji in QML. Using default TextField, I've known that due to OS-depended font rendering system have different draw results (on site below you can see native emoji rendering on your OS, and on Windows they look ugly and different with Mac OS X). Thus I came to the possible solution as drawing (using QPainter) Emoji Unicode symbols as picture (16x16 in PNG) instead. But I've also found that QML TextField implementation using Qt private API (QQuickTextField - there is no open include files in SDK), and the only class to make own QML component - QQuickItem (QQuickPaintItem), but I think (due to sources of the QQuickTextField) that in this case I need to make full text editor from the scratch. What can be a possible solution in my case?


  • Moderators

    @alejandro_pnz TextField doesnot allow rich text. If possible you can use TextArea instead which allows rich text. Since you are considering using images you can do the following:

    TextArea {
        textFormat: TextEdit.RichText
        text: "Hi" + "<img src=\"smiley.png\">"
    }
    


  • I am not talking about RichText image drawing, I am talking about custom re-draw function.


  • Moderators

    @alejandro_pnz I just suggested an alternative to TextField since you came up with drawing PNG's instead. This would have saved you from adding a custom functionality. Now since you are thinking of creating a text editor may we know how different it would be than using a TextArea ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.