Results 1 to 2 of 2

Thread: Implementing Save Feature in Javascript app using Qt

  1. #1
    Join Date
    Jul 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Maemo/MeeGo

    Default Implementing Save Feature in Javascript app using Qt

    Hi,

    I have an application written in JavaScript. I am trying to port it on on Maemo Platform using Qt.

    I am facing problems in implementing "Save feature" to it. Whatever data I write on my application is saved in a "string" in a dosave() function of my JavaScript file.

    I am using this code to interact with JavaScript function:

    Qt Code:
    1. void Test::on_pushButton2_clicked()
    2. {
    3.  
    4. QVariant name;
    5.  
    6. QString fileName = QFileDialog::getSaveFileName(this,
    7. tr("Save file"), "",
    8. tr("Myapp (*.app);;All Files (*)"));
    9.  
    10. if (fileName.isEmpty())
    11. return;
    12. else {
    13. QFile file(fileName);
    14. if (!file.open(QIODevice::WriteOnly)) {
    15. QMessageBox::information(this, tr("Unable to open file"),
    16. file.errorString());
    17. return;
    18. }
    19.  
    20.  
    21. name = webView->page()->mainFrame()->evaluateJavaScript("dosave()");
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 

    I am able to save my file but when I open it , I get blank file again with no data in it.
    I am not able retrieve data.

    Kindly suggest some solution to my problem.
    What are the ways I can save the data returned by the JavaScript function and can get back same thing on my file when I open it.
    How can I implement data structures or Hash table in Qt programming, where I can save the strings returned and then use them in function created in Javascript used to open my saved files ?
    Kindly suggest some solutions.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Implementing Save Feature in Javascript app using Qt

    In which line of code of your example do you think does the actual write to the file happen?
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Qt on S60 problem:'Menu Feature not supported'
    By Amit_3117 in forum Qt Programming
    Replies: 1
    Last Post: 13th October 2009, 06:38
  2. Implementing Autoscroll feature in QT-WebKit
    By srinirao in forum Qt Programming
    Replies: 0
    Last Post: 3rd August 2009, 11:58
  3. Qt4 and windows vista handwriting feature
    By Gnurou in forum Qt Programming
    Replies: 3
    Last Post: 2nd April 2009, 22:42
  4. Firebird SQL Driver and Feature POST_EVENT
    By estanisgeyer in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2008, 20:49
  5. QTransform scaling and translate feature.
    By AmolShinde_8 in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2008, 10:31

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
  •  
Qt is a trademark of The Qt Company.