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

Adding emojis



  • Hello,
    I have written a ChatClient and currently I am trying to implement Emojis into the programm.
    I want to click on a button and afterwards a window opens up with some emojis you can choose from.
    Unfortunately I could not find anything helpful on the Internet and I have no Idea how to implement it.
    I hope somebody knows.



  • I would utelize the QInputDialog, something like this:

      QString name = QInputDialog::getText(this,
               tr("Add task"),
               tr("Task name"),
               QTableWidget::Normal,
               tr("Untitled task"),			&ok);
    

    You can fill the Table widget with emoticons and remove the borders and headers and fill the cells with QIcons and your emojis, maybe putting the QString paths tho the emojis in a QVector.

    Have fun :) Shouldn't be that difficult


  • Lifetime Qt Champion

    Hi,

    @JackTr dialog suggestion is a good one however there are no pre-backed method for that. Still you can build your dialog with rather a QListView as it provides an easier setup to load your icons in a grid that you can size easily.



  • Yeah, QListView is a nice one. Maybe without even a dialog but a scroll area, depending on how many icons he got. And than connecting a button to a function that toggles the widget between

    ->setHide(true)
    

    and

    ->setHide(false)
    

    Or a QTabWidget to show and switch between icon categories :) Qt is such a greate tool - freedom and fun :)


  • Lifetime Qt Champion

    @JackTr no need for a scroll area, it's already provided in the various item views subclasses.


Log in to reply