Results 1 to 2 of 2

Thread: [webkit] how to downlad file by simple click

  1. #1
    Join Date
    May 2010
    Posts
    22
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default [webkit] how to downlad file by simple click

    Hi.

    I have to download file from page using webkit. When I click RMB it showed contentmenu with "save link..." option.
    But I need to detect download request by LMB.

    downloadRequested() signal is emitted only when i use right button. How to force webkit to download file using single click by left mouse button?

    Thanks

  2. #2
    Join Date
    May 2010
    Posts
    22
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [webkit] how to downlad file by simple click

    after 10h search i found solution.

    Qt Code:
    1. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    2. ui->webView->page()->setNetworkAccessManager(manager);
    3. connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
    To copy to clipboard, switch view to plain text mode 

    slot:
    Qt Code:
    1. void MainWindow::replyFinished(QNetworkReply *reply)
    2. {
    3.  
    4. if(reply->rawHeader("Content-Type")!="text/html")
    5. {
    6. // code to execute download
    7. }
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

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

    TinTin (24th August 2011)

Similar Threads

  1. Replies: 4
    Last Post: 17th February 2010, 10:52
  2. How to open any file on button click???
    By r3aktor in forum Newbie
    Replies: 5
    Last Post: 8th July 2009, 08:54
  3. How to read a simple xml file.
    By bod in forum Qt Programming
    Replies: 17
    Last Post: 27th June 2008, 09:13
  4. Replies: 2
    Last Post: 2nd April 2008, 17:28
  5. Simple click detection on QTextBroxser
    By Nyphel in forum Newbie
    Replies: 4
    Last Post: 10th April 2007, 12:46

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.