PDA

View Full Version : [Qt4] Signal printRequest



maston
6th May 2010, 10:12
Hi.

I'm trying to print QWebView mainframe content from javascript method 'window.print()'. I wrote line:

QObject::connect(ui->webView->page(), SIGNAL('printRequested()'), SLOT(print()));



And i have compilator info :

No such signal QWebPage::'printRequested()' .
i try diffrent constructions but always is info that no such signal...

Maybe someone has a solution?
Sorry for my english.
Regards

borisbn
6th May 2010, 11:32
remove quotes like this:

QObject::connect(ui->webView->page(), SIGNAL(printRequested()), SLOT(print()));

maston
6th May 2010, 12:28
the same result :
Object::connect: No such signal QWebPage:: printRequested() ... :(

borisbn
6th May 2010, 13:21
from Qt docs:

void QWebPage::printRequested ( QWebFrame * frame ) [signal]
you should write your own slot like

void MyWidget::onPrintRequested(QWebFrame * frame )
{
...
}
and connect in following way


QObject::connect( ui->webView->page()
, SIGNAL( printRequested( QWebFrame * ) )
, SLOT( onPrintRequested(QWebFrame * ) )
);

maston
6th May 2010, 13:37
It works. :)
Thank you very much :)