-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix displaying escaped characters in message boxes #9417
Conversation
This isn't the correct fix because you still want to HTML escape the title otherwise HTML elements in the title will be rendered like < and >. You should keep the HTML escaping but convert I actually think this is a bonefide Qt bug in that it is not rendering escaped HTML characters correctly. |
Qt is doing some on-the-fly content detection AFAIK, which is ridiculous. Setting it to a fixed value is definitely part of the solution. |
OK, I made some fixes according to @droidmonkey's suggestions. Now it escapes HTML and displays & correctly. |
I think the solution is incorrect. You are partially reverting your HTML escaping, which makes no sense to me. Either you escape or you don't and if you do, it either displays correctly (i.e., the message box accepts HTML) or it doesn't (then you get double escaping). Instead of trying to mess with the escaping, you should set the textFormat property of the message box to PlainText. https://doc.qt.io/qt-6/qmessagebox.html#textFormat-prop |
Had to give this a one-two punch. HTML escaping the titling is necessary to keep the title intact, and the message box needs to be set explicitly as "Rich Text" so that html formatting in the message will be shown and escaped characters will be decoded properly. This is the same problem that the Entry Preview Panel had. |
…val dialog
I changed the TextType in MessageBox class to plain text so as to display the & character correctly and prevent HTML injection.
Fixes #9356
Screenshots
Type of change