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. Qml srting to QString
Forum Updated to NodeBB v4.3 + New Features

Qml srting to QString

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

    I am getting an empty string when I try to send qml text, withMyclass.write("some text") this works

    Q_INVOKABLE void write(QString text)
    {
    //
    }
    
    Text
    {
    id: myText
    text: fronthell
    }
    MouseArea
    {
    id: ma
    Myclass.write(myText.text)
    }
    
    ODБOïO 1 Reply Last reply
    0
    • JobRecrdJ JobRecrd

      I am getting an empty string when I try to send qml text, withMyclass.write("some text") this works

      Q_INVOKABLE void write(QString text)
      {
      //
      }
      
      Text
      {
      id: myText
      text: fronthell
      }
      MouseArea
      {
      id: ma
      Myclass.write(myText.text)
      }
      
      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @JobRecrd said in Qml srting to QString:

      Myclass.write(fronthell.text)

      should be

      MouseArea
      {
      id: ma
      onClicked : {
        Myclass.write(myText.text)
      }
      }
      
      JobRecrdJ 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @JobRecrd said in Qml srting to QString:

        Myclass.write(fronthell.text)

        should be

        MouseArea
        {
        id: ma
        onClicked : {
          Myclass.write(myText.text)
        }
        }
        
        JobRecrdJ Offline
        JobRecrdJ Offline
        JobRecrd
        wrote on last edited by
        #3

        @LeLev Sorry,
        Sorry, I made a mistake in the post, it says myText.text and it doesn't work for some reason.

        ODБOïO 1 Reply Last reply
        0
        • JobRecrdJ JobRecrd

          @LeLev Sorry,
          Sorry, I made a mistake in the post, it says myText.text and it doesn't work for some reason.

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

          @JobRecrd
          see what you get if you print myText.text

          onClicked : {
           console.log(myText.text)
           //Myclass.write(myText.text)
          }
          

          also what is "fronthell" is that a variable ?

          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