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. check if object is an url and create url type
Forum Updated to NodeBB v4.3 + New Features

check if object is an url and create url type

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

    Hi,

    I have an image.source which have as input even a QUrl from C++, even a String from javascript.

    So I need to convert the later to url type to make it works, then I need 2 things:

    • check if input is url type or string
    • create an url (need something like QUrl.fromLocalFile)

    thanks for help

    Jimmy

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

      for now it does work:

      var content = ddb.loadSection(sectionId)
      var path = content.path.toString()
      img.source = path.startsWith("file:///") ? content.path :  "file:///" + path
      

      I hesitate to mark it as solved since I don't know how dirty it is :-)

      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