Results 1 to 4 of 4

Thread: webview event as a signal/slot for urlChanged

  1. #1
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default webview event as a signal/slot for urlChanged

    I have used connection signals & slots before, but always with a ui->pushButton, a ui->action, or a ui->actionToolBar.... I guess my question is how to do this with a webView event?

    Trying to download a file through the course of going through some webpages, I don't want to have a seperate QButton to download the file when it finally is sent to the QWebView, but a connection signal/slot to realize that it is a file with extension of .xls (already created) just need to trigger a method to start the QFileDialog::getSaveFileName() function... can this be a connection through the QWebView?

    Qt Code:
    1. ui->setupUi(this);
    2. ui->webView->load(QUrl("http://site.com/index.php"));
    3. ui->webView->show();
    4.  
    5. //now put connection for checking class method if a changed url is actually a file with .xls extension
    6. connect(ui->webView, SIGNAL(urlChanged(QUrl url&)), this, SLOT(checkForXLS()));
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: webview event as a signal/slot for urlChanged

    QWebView does have a void urlChanged ( const QUrl & url ) signal,don't see any problems with using it. See docs for the details.

  3. #3
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: webview event as a signal/slot for urlChanged

    looks like I'm trying to do more like a download manager using QNetworkAccessManager. Trying to a give a simple browser QT application a download file functionality. Like trying to combine the Qt/examples/network/http or the Qt/examples/network/downloadmanager program with the Qt/examples/webkit/fancybrowser program. I have some extensive php MySQL pages that saves a data array as a file called test.xls But the Qt program that is using a Qwebview to display all of this needs connection signal/slots to save a .xls file type. I see that doesn't work with the fancy browser example, but it works with the http program (even though it warns not to use that way of doing it) It does work with the Aurora Demo, but that's just an executeable demo.

  4. #4
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: webview event as a signal/slot for urlChanged

    I went and bought the Advanced Qt Programming: Creating Great Software with C++ and Qt 4, by Mark Summerfield It nicely explains the above questions, but i'm only half way through reading it today...

Similar Threads

  1. Replies: 3
    Last Post: 26th April 2011, 23:12
  2. signal/slot or subclassed event?
    By liqxpil in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2010, 11:15
  3. Problem with urlChanged signal
    By lucenty in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 13:40
  4. signal and slot across threads having event loop
    By travis in forum Qt Programming
    Replies: 6
    Last Post: 5th November 2007, 23:56
  5. What's the relationship between signal/slot and event?
    By twosnowman in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 17:13

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.