Results 1 to 6 of 6

Thread: Access to js imported file in another qml file

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Access to js imported file in another qml file

    Hi all..
    Is it possible to access to javascript file in multi qml files??? suppose i've parent qml file which js file is defined there and i want to access to it in child qml files

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Access to js imported file in another qml file

    You can declare the file to be a library. Then you can include it multiple times.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    alizadeh91 (16th July 2012)

  4. #3
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Access to js imported file in another qml file

    Thanks for reply but there is a problem
    When i define the js file as a ".pragma library" it doesn't recognize id of qml objects.
    What's the problem?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Access to js imported file in another qml file

    A library can only contain functions.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Access to js imported file in another qml file

    Thanks.I've passed the id by function arguments and it works In A library we can't define variables??!! I've defined them and there is nothing wrong!


    Added after 12 minutes:


    Just another question! I create some dynamic object in this .js file and i want to get focused element in this file. How can i do that??
    Thanks anyway
    Last edited by alizadeh91; 16th July 2012 at 14:41.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Access to js imported file in another qml file

    Quote Originally Posted by alizadeh91 View Post
    Just another question! I create some dynamic object in this .js file and i want to get focused element in this file. How can i do that??
    I don't understand what you mean.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Blocking file access
    By K.Sejdak in forum Qt Programming
    Replies: 4
    Last Post: 27th June 2011, 10:13
  2. Can we access .mdb file from Qt creator
    By revathisuma in forum Qt Programming
    Replies: 1
    Last Post: 13th April 2011, 03:46
  3. Access an object from another file.
    By cbarmpar in forum General Programming
    Replies: 1
    Last Post: 6th September 2008, 23:17
  4. How to create a access file .mdb
    By aiikcmo in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 11:06
  5. Access MS .mdb file on Linux
    By iGoo in forum Qt Programming
    Replies: 3
    Last Post: 15th June 2006, 10:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.