Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
6.7
-
None
-
Any.
-
-
2dbcb25bf (dev)
Description
QMessageBox has a default text label and also has a informative label. Developers can set both of them for the message box. Developers can also set the text format for the text label, but not the informative label, so if developers want to use Markdown (introduced in Qt 5.15) in QMessageBox, the informative label won't be able to render markdown text as intended.
Minimized reproduce code:
// main.cpp // To build: g++ main.cpp `pkg-config --cflags --libs Qt6Widgets` #include <QApplication> #include <QMessageBox> int main(int argc, char **argv) { QApplication a(argc, argv); QMessageBox mb; QString text("Text [link](#) text"); mb.setTextFormat(Qt::MarkdownText); mb.setText(text); mb.setInformativeText(text); mb.exec(); return 0; }
Result:
As you can see, the label above rendered the text as markdown, the informative label below rendered the text as plain text.
Related patch to fix this issue: https://codereview.qt-project.org/c/qt/qtbase/+/542531