How to color detailedText in MessageDialog, QML
-
Hi all,
Please take a look at this text:
Text { id: myText text: qsTr("Hello to the World!") }
How to change this to make the sole word "World" , say orange, please? The rest is black.
-
@tomy
see https://doc.qt.io/qt-5/qml-qtquick-text.htmlText { text: " Hello to the <font color='orange'> World </font>!" }
you can also do
RowLayout{ Text{}//with needed color Text{} Text{} }
-
@LeLev
Thanks.That color is used for a
detailedText
in aMessageDialog
, as shown below. Neither solution works!@tomy
The MessageBox QML Type Documentation don't say nothing about how detailedText is interpreted in QML.
But, in MessageBox Widget (cpp), the detailexText property is interpreted as Plain Text and means it will not know Tags.
I suppose that QML Version uses the same idea of Cpp version.https://doc.qt.io/qt-5/qml-qtquick-dialogs-messagedialog.html
https://doc.qt.io/qt-5/qmessagebox.html#detailedText-prop -
@tomy
The MessageBox QML Type Documentation don't say nothing about how detailedText is interpreted in QML.
But, in MessageBox Widget (cpp), the detailexText property is interpreted as Plain Text and means it will not know Tags.
I suppose that QML Version uses the same idea of Cpp version.https://doc.qt.io/qt-5/qml-qtquick-dialogs-messagedialog.html
https://doc.qt.io/qt-5/qmessagebox.html#detailedText-propSo no way to manipulate that text message.
Thank you for your answer.