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

Disabling characters interpretation



  • Hello,
    I've found a weird behaviour using QLineEdit: entered text is parsed and transformed in something else when using some special characters. For example, when the user enters "a&bc" Qt displays "abc" underlining the 'b' character. Of course this tampers the user input and must be disabled, but I can't even figure how developers decided to name this awful feature, not to mention where is documented. Does anybody know if this can be disabled, and where it is described in the documentation?

    Thanks in advance!
    Marco


  • Lifetime Qt Champion

    @Marco-Palestro Just checked on Windows 10, Qt 5.11 MinGW: can't reproduce the issue.
    What OS is it? Which Qt versions? Are you sure it is QLineEdit and how did you configure it?



  • I'm using qt 5.6.3 for an old project, a multiplatform GUI running on windows and android; windows version is compiled with mingw, but the problem is the same on android platform. I don't think it's related to platform or tool chain, it is clearly an "applicative" feature.
    I made a mistake looking in the code; QLineEdit is used while editing, but then the text is displayed through a QPushButton stylized to seem a label (sorry, not my code). This must be related to accelerators used on buttons; do you know if it's possible to disable this feature?


  • Lifetime Qt Champion

    @Marco-Palestro said in Disabling characters interpretation:

    QLineEdit is used while editing, but then the text is displayed through a QPushButton

    This is an important information. So, it's not QLineEdit but QPushButton.
    I just checked: you need to put && instead of &. That means, before setting the text in the button you need to double &



  • Yes, thank you!
    Regards
    Marco


Log in to reply