I found the answer.
when "Save Image" aticon clicked , i received downloadRequested signals.
i get image src from QNetworkRequest.
connect(this->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(slt_downloadRequested(QNetworkRequest)));
connect(this->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(slt_downloadRequested(QNetworkRequest)));
To copy to clipboard, switch view to plain text mode
if "Open Image" aticon clicked :
#define Flag_OpenImage 0
#define Flag_SaveImage 1
connect(this->pageAction(QWebPage::OpenImageInNewWindow),SIGNAL(triggered(bool)),this,SLOT(slt_openImage_triggered()));
connect(this->pageAction(QWebPage::OpenImageInNewWindow),SIGNAL(triggered(bool)),this->pageAction(QWebPage::DownloadImageToDisk),SIGNAL(triggered(bool)));
void slt_openImage_triggered(){
m_iDefultMenuFlag = Flag_OpenImage;
}
void slt_downloadRequested{
if(m_iDefultMenuFlag == Flag_OpenImage){
//do something ...
}else if(m_iDefultMenuFlag == Flag_SaveImage){
//do something ...
}
}
#define Flag_OpenImage 0
#define Flag_SaveImage 1
connect(this->pageAction(QWebPage::OpenImageInNewWindow),SIGNAL(triggered(bool)),this,SLOT(slt_openImage_triggered()));
connect(this->pageAction(QWebPage::OpenImageInNewWindow),SIGNAL(triggered(bool)),this->pageAction(QWebPage::DownloadImageToDisk),SIGNAL(triggered(bool)));
void slt_openImage_triggered(){
m_iDefultMenuFlag = Flag_OpenImage;
}
void slt_downloadRequested{
if(m_iDefultMenuFlag == Flag_OpenImage){
//do something ...
}else if(m_iDefultMenuFlag == Flag_SaveImage){
//do something ...
}
}
To copy to clipboard, switch view to plain text mode
Thanks to the http://www.qtcentre.org .
Bookmarks