×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    File Handeling in QML

    Hi,
    I am tring to do some file handeling in qml. But could not see any elements for that, am i missing out something?
    My queries are given below
    1. Read/Write files in qml.
    2. Append text in an existing file in qml.

    For 2. Lets say i have an existing text file with some existing text in it. Now how can i append some more text in it after a string ' addtexthere'. I mean to say how can i find this 'addtexthere' string from my text file and add after this.


    Can i do this with qml or javascript,without using c++


    please suggest me.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: File Handeling in QML

    hello somnath

    AFAIK there is no way you can do file manipulation in qml. There are ways in JavaScript but i am not sure if they will work or not for symbian.

    The preferred way will be do all sort of file manipulation in c++ only and if you have tried that please share the problem you are facing.

  3. #3
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: File Handeling in QML

    I got one thread http://www.developer.nokia.com/Commu...ipt#post838516
    but i am not able to open file using javascript.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: File Handeling in QML

    yes first method is the one which i prefer too, but if you dont want to write an plug in, simply make a c++ class which handles all file manipulations you want to do. Expose the object of that class as context property and call the relevant methods from QML.

  5. #5
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: File Handeling in QML

    Quote Originally Posted by gaba88 View Post
    yes first method is the one which i prefer too, but if you dont want to write an plug in, simply make a c++ class which handles all file manipulations you want to do. Expose the object of that class as context property and call the relevant methods from QML.
    I am trying exactly the same way. I am trying to call a function from C++ as we do in javascript in QML. I am using this article http://developer.qt.nokia.com/doc/qt...3-5f7e8f90831a
    I have created the myclass.cpp and myclass.h and trying to call the function from QML


    but could not call the function, may be i am missing something.
    Last edited by somnathbanik; 2011-08-17 at 07:41. Reason: added

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: File Handeling in QML

    have you added the Q_INVOKABLE macro while declaring your method.

  7. #7
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: File Handeling in QML

    Quote Originally Posted by gaba88 View Post
    have you added the Q_INVOKABLE macro while declaring your method.
    i have solved this issue, it was just the class inheritance problem of mine.
    Thank you Gargi.

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: File Handeling in QML

    cool enjoy :-)

  9. #9
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,357

    Re: File Handeling in QML

    yes, but now i need to work on my main issue, writing data after a certain staing in the file

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: File Handeling in QML

    Somnath sorry but your question is not clear to me, do you want to say you want to append something in the file like open the file and add some data correct ??

Similar Threads

  1. How to call/load another QML file from QML ?
    By cadlg in forum [Archived] Qt Quick
    Replies: 5
    Last Post: 2011-07-28, 09:15
  2. Global variable in js file to use in more QML files
    By AlterX in forum [Archived] Qt Quick
    Replies: 0
    Last Post: 2011-07-24, 10:48
  3. Import Other QML File In Code
    By dhruvbhutani in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-06-23, 10:47
  4. How to open a file in QML script?
    By useryy2 in forum [Archived] Qt Quick
    Replies: 3
    Last Post: 2011-05-04, 10:12
  5. How to handel event handeling of mobile keys in series40 nokia devices
    By tushar.barbhai in forum Mobile Java General
    Replies: 6
    Last Post: 2009-07-22, 17:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×