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. How to divide QString?

How to divide QString?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 539 Views
  • 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.
  • YunusY Offline
    YunusY Offline
    Yunus
    wrote on last edited by Yunus
    #1

    Hi all,
    I have a text in qml which I copied below. I want to divide one text into 2 or more and assign it to another text. In onSomeSignal scope, I want to divide the sentence. For example I dont need whole sentence only need "apple"How can I do that?

    Text {
            id: first
        }
        Connections           
        {
            id:connection
            target:controller
            ignoreUnknownSignals: true
    
            onSomeSignal: {
                  
                  first.text = (I need here only "apple" of second text)
           }
        }
        Text {
            id: second             
            text: qsTr("apple fruit vegetable")
    
        }
    
    J.HilkJ 1 Reply Last reply
    0
    • YunusY Yunus

      Hi all,
      I have a text in qml which I copied below. I want to divide one text into 2 or more and assign it to another text. In onSomeSignal scope, I want to divide the sentence. For example I dont need whole sentence only need "apple"How can I do that?

      Text {
              id: first
          }
          Connections           
          {
              id:connection
              target:controller
              ignoreUnknownSignals: true
      
              onSomeSignal: {
                    
                    first.text = (I need here only "apple" of second text)
             }
          }
          Text {
              id: second             
              text: qsTr("apple fruit vegetable")
      
          }
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Yunus If you want to do it in QML,
      have a look at the JS- String operations that are available for you
      https://www.w3schools.com/jsref/jsref_obj_string.asp

      That should include all tools you need for that task.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • YunusY Offline
        YunusY Offline
        Yunus
        wrote on last edited by
        #3

        @J-Hilk Ahh. okey thats what I m looking for. Ty.

        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