Results 1 to 4 of 4

Thread: signal/slot for a Qebview urlChanged event

  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 signal/slot for a Qebview urlChanged event

    this is a silly question, that most likely has an easy answer... but if I have a Qwebview called ui->webView... how do I connect the webview event as a signal and slot for a urlChanged()?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: signal/slot for a Qebview urlChanged event

    You start by reading the signals and slots documentation.

    And then you will write something like:
    Qt Code:
    1. connect(ui->webView, SIGNAL(urlChanged (QUrl) ), OBJECT_TO_CONNECT, SLOT(SLOT_TO_EXECUTE(QUrl)) );
    To copy to clipboard, switch view to plain text mode 
    //i don't know for sure if the correct parameter is QURL, check here

  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: signal/slot for a Qebview urlChanged event

    shouldn't this work if I have the checkForXLS(); as a PRIVATE SLOT: in the header file and a method for it as well?

    connect(ui->webView, SIGNAL(urlChanged(QUrl url&)), this, SLOT(checkForXLS()));

    Added after 6 minutes:


    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 


    Added after 7 minutes:


    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?


    Added after 10 minutes:


    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?
    Last edited by budda; 26th April 2011 at 12:16.

  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: signal/slot for a Qebview urlChanged event

    looks like I have to set up QNetworkAccessManager connection classes.....

Similar Threads

  1. signal/slot or subclassed event?
    By liqxpil in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2010, 11:15
  2. Problem with urlChanged signal
    By lucenty in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 13:40
  3. signal and slot across threads having event loop
    By travis in forum Qt Programming
    Replies: 6
    Last Post: 5th November 2007, 23:56
  4. Replies: 4
    Last Post: 23rd January 2006, 16:51
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.