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] Stripping double quotes from string

[Solved] Stripping double quotes from string

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 4.2k 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.
  • S Offline
    S Offline
    situ117
    wrote on last edited by
    #1

    Hi,

    If I try to call toString() method on any object in QML, it's string representation is always enclosed in escaped double quotes. For e.g.

    calling toString() on a url object gave me:

    "http://en.wikipedia.org/wiki/India_(disambiguation)"

    Why is it like this ? Does QML have any function to strip these surrounding escaped double quotes ? Actually I was doing some string processing using Javascript and having these double quotes is strange.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      Could you paste an example showing the problem?

      The following seems to output the correct string and length for me (doesn't include the escaped double quotes)
      @
      import QtQuick 1.0

      Rectangle {
      width: 400; height: 400

      property url myProp: "index.qml"
      
      Component.onCompleted: console.log(myProp + " " + myProp.toString().length)
      

      }
      @

      Does it work correctly for you?

      Regards,
      Michael

      1 Reply Last reply
      0
      • S Offline
        S Offline
        situ117
        wrote on last edited by
        #3

        Hi,

        Ok, it's not a problem with QML. I was trying to catch linkClicked(QUrl) signal from QWebView in C++, and pass them to QML. By default QUrl encloses urls in double quotes while converting them to strings ( when I call toString() ).

        Thanks for your reply !!!

        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