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. have two color of one word
Forum Updated to NodeBB v4.3 + New Features

have two color of one word

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    beh_zad
    wrote on last edited by
    #1

    I am looking for a way to change the first letter color of a single word, in other work I want to have one word with two different color.
    What should I do in Text QML?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rem-Kolomna
      wrote on last edited by
      #2

      I think you can use this:

      Label {
          text: "<font color=\"blue\">H</font>ello"
      }
      
      B 1 Reply Last reply
      0
      • B Offline
        B Offline
        beh_zad
        wrote on last edited by
        #3

        thanks for replying, but I have several columns and each of columns filled with several text, I created a TextField to prepare a search tool for user, when user type a letter in TextField I want the color of these letters that match is change.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rem-Kolomna
          wrote on last edited by
          #4

          I think you should use TextArea instead and listen to keyboard events and add formatted text (like in label) as you need

          1 Reply Last reply
          0
          • R Rem-Kolomna

            I think you can use this:

            Label {
                text: "<font color=\"blue\">H</font>ello"
            }
            
            B Offline
            B Offline
            beh_zad
            wrote on last edited by
            #5

            @Rem-Kolomna I did it, Thanks for your help

            1 Reply Last reply
            0

            • Login

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