Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cannot assign to non-existent property "color"

Cannot assign to non-existent property "color"

Scheduled Pinned Locked Moved General and Desktop
4 Posts 1 Posters 2.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.
  • J Offline
    J Offline
    jedi_knight
    wrote on last edited by
    #1

    Could anyone help me please? I'm trying to highlight input field when textinput is in focus.
    @ Rectangle {
    TextInput {
    anchors.centerIn: parent
    text:parent.color
    parent.color: focus? "#fafafa" : "#eee"
    }
    }@
    If i comment out parent.color it works and shows parent's color as text. However, when I'm trying to change parent's color I get following error message:
    Cannot assign to non-existent property "color"
    Is it a bug in qt? I'm using qt 5.3 with qtquick 2.2

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jedi_knight
      wrote on last edited by
      #2

      Fixed it with a kind of a hack:
      I inserted MouseArea inside TextInput and changed parent.parent.focus to true, than it worked. But I still don't understand why can't I assign color directly.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jedi_knight
        wrote on last edited by
        #3

        Well, not really a fix, since I can't edit textinput this way. My reply was premature.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jedi_knight
          wrote on last edited by
          #4

          http://stackoverflow.com/questions/16518596/getting-focus-activefocus-status-from-qml-listview
          used onActiveFocusChanged: { focusChanged(focus) }
          as a workaround, now it works as I intended.

          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