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

Cheap external representation of a font family, to be used with QTextEdit



  • Hi everyone, I briefly explain the context of my problem. I am working with a QTextEdit and I need to have the information of the font family for each of the characters. I will use this to write in another QTextEdit the character with the right font family.

    At the moment I use the whole string describing the font family, so for example "Times New Roman".
    Now I would like to have a compact representation to do that, for example an integer or a short string that can be used to say that the font family must be "Times New Roman". In other words, I want to avoid storing the whole "Times new Roman" for each character.
    I noticed that there is a method key() in QFont, but it seems that it's not intended to make the traslation back to the QFont.

    Does anyone have any idea on how to achieve this?


  • Lifetime Qt Champion

    @RiccardoZack said in Cheap external representation of a font family, to be used with QTextEdit:

    Does anyone have any idea on how to achieve this?

    No, there is no other way.


Log in to reply