Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to color detailedText in MessageDialog, QML
Forum Update on Monday, May 27th 2025

How to color detailedText in MessageDialog, QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by tomy
    #1

    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.

    ODБOïO 1 Reply Last reply
    0
    • tomyT tomy

      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.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @tomy
      see https://doc.qt.io/qt-5/qml-qtquick-text.html

        Text {
              text: " Hello to the <font color='orange'> World </font>!"
          }
      

      you can also do

      RowLayout{
        Text{}//with needed color
        Text{}
        Text{}
      }
      
      tomyT 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @tomy
        see https://doc.qt.io/qt-5/qml-qtquick-text.html

          Text {
                text: " Hello to the <font color='orange'> World </font>!"
            }
        

        you can also do

        RowLayout{
          Text{}//with needed color
          Text{}
          Text{}
        }
        
        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #3

        @LeLev
        Thanks.

        That color is used for adetailedText in aMessageDialog, as shown below. Neither solution works!

        0_1555683274103_Capture.PNG

        KillerSmathK 1 Reply Last reply
        0
        • tomyT tomy

          @LeLev
          Thanks.

          That color is used for adetailedText in aMessageDialog, as shown below. Neither solution works!

          0_1555683274103_Capture.PNG

          KillerSmathK Offline
          KillerSmathK Offline
          KillerSmath
          wrote on last edited by KillerSmath
          #4

          @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

          @Computer Science Student - Brazil
          Web Developer and Researcher
          “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

          tomyT 1 Reply Last reply
          2
          • KillerSmathK KillerSmath

            @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

            tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by
            #5

            @KillerSmath

            So no way to manipulate that text message.
            Thank you for your answer.

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved