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. Qt 4.8 qml; javascript method does not work

Qt 4.8 qml; javascript method does not work

Scheduled Pinned Locked Moved Solved QML and Qt Quick
javascriptqmlqt 4.8symbian
2 Posts 1 Posters 1.4k 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.
  • D Offline
    D Offline
    Dante Leoncini
    wrote on 29 Jun 2016, 00:57 last edited by Dante Leoncini
    #1

    Hi. I 'm trying to use javascript methods but many do not work and found me a list of methods that do work in qt 4.8. Probe with simple standard codes and so do not understand that failure

    I 'm trying to create a function that returns a string trimmed

    the chain is for example: "file///E:/texto.txt"

    I want it to be: "E:/texto.txt"

    the function to use is:

    property string texto = "file///E:/texto.txt"
    
    function ubicacion(x) {
        var re = x;
        var ext = re.substring(7);
       return ext
    }
    
    ubicacion(texto)
    

    this does not work. probe write a thousand different ways and with other similar methods. I also tried javascript basic methods but do not work .

    use "substring", "substr", "slice", "length"

    in the same code and use this code if it works:

    function extension(x) {
        var re = /(?:\.([^.]+))?$/;
        var ext = re.exec(x)[1];
        return ext
    }
    

    and not know what else to try

    He added : Accomplish make it work with a normal string . but when I use another string it does not work. try using " toString(x)" but gives nullo value

    x = filePath
    (filePath from Qt.labs.folderlistmodel 1.0)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dante Leoncini
      wrote on 29 Jun 2016, 03:20 last edited by
      #2

      achieve make it work like this:

      property string archivo: null
      
      function ubicacion(x) {
         archivo = x;
         return archivo.substr(8);
      }
      
      1 Reply Last reply
      0

      1/2

      29 Jun 2016, 00:57

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved