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. [Solved] TextInput: font color change when text changes

[Solved] TextInput: font color change when text changes

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 4 Posters 6.2k Views 2 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.
  • P Offline
    P Offline
    pascal95abc
    wrote on last edited by VRonin
    #1

    Hello.

    There is nothing like onChange for the TextInput but only onDisplayDataChanged what didn't work for me.

      TextInput { id: text_input1
                width: 80
                height: 20
                text: qsTr("234234")
                font.pixelSize: 12
                inputMethodHints: Qt.ImhFormattedNumbersOnly
                on???:  {
                    text_input1.color = "#333333"
            }}
    

    And how can I set the same effect for different events, I want to call the same function when on?1 or on?2 or on?3 is called.

    something like
                on?1,on?2,...,.., :  {
                    text_input1.color = "#333333"
            }
    

    but didnt work

    Thank you ;)

    Qt 4.7.3
    Symbian OS v9.4 / Symbian^1, S60 5th Edition
    on N97

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by VRonin
      #2

      For every property in QML there is signal on<PropertyName>Changed. So you need onTextChanged.

      For your second question: No. You should write signal handling one by one.

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • P Offline
        P Offline
        pascal95abc
        wrote on last edited by
        #3

        Ok, thank you ;)

        Qt 4.7.3
        Symbian OS v9.4 / Symbian^1, S60 5th Edition
        on N97

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MTOLANI
          wrote on last edited by
          #4

          Hi, how did you solve this issue?

          VRoninV 1 Reply Last reply
          0
          • M MTOLANI

            Hi, how did you solve this issue?

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5

            @task_struct said in [Solved] TextInput: font color change when text changes:
            So you need onTextChanged.

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MTOLANI
              wrote on last edited by
              #6

              @VRonin I am using TextEdit

              TableViewColumn {
                              role: "default"
                              title: qsTr("Default Value")
                              width: 150
                              delegate:
                                  TextEdit {
                                  id:defaultValue
                                  text: styleData.value
                              }
                          }
              

              When I edit the text, it isn't getting saved. Any idea what i should do?

              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