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. Cannot change text of Text1

Cannot change text of Text1

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 524 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.
  • D Offline
    D Offline
    DTRQ
    wrote on last edited by
    #1

    Hi
    I'm trying to make an Android application. Everything is fine, but I can't change text of Text1. I've created function "function setText(value1)" and I've put "txt1 = value1" in this function. I've added "property alias txt1: text1.text", too. This function is begin called from C++, but I think it is not a problem, because if i put "console.log(value1)" in the function, value1 is showing up normally in the console. Here's some code from pastebin.
    Thanks, DTRQ

    (sorry for my english)

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      hi @DTRQ
      this must work:

      property string tx
      onTxChanged : {
         text1.text = tx
      }
      Text {
      id: text1
      }
      function setText(value1) {
       tx=value1
      }
      

      or maybe try without alias :

      Text {
      id: text1
      }
      function setText(value1) {
       text1.text=value1
      }
      
      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