void ReportDialog::showPreview() { if ( m_page ) return; QPrinter* printer = application->printer(); printer->setFromTo( 0, 0 ); QString html = generateHtmlReport( false ); m_page = new QWebPage( this ); connect( m_page->mainFrame(), SIGNAL( loadFinished( bool ) ), this, SLOT( previewReady() ) ); m_page->mainFrame()->setHtml( html ); }
void ReportDialog::print() { if ( m_page ) return; QPrinter* printer = application->printer(); printer->setFromTo( 0, 0 ); QPrintDialog dialog( printer, this ); if ( dialog.exec() != QDialog::Accepted ) return; QString html = generateHtmlReport( false ); m_page = new QWebPage( this ); connect( m_page->mainFrame(), SIGNAL( loadFinished( bool ) ), this, SLOT( printReady() ) ); m_page->mainFrame()->setHtml( html ); }
void QPrinterProto::setFromTo(int from, int to) { QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject()); if (item) item->setFromTo(from, to); }
int Printer::setFromTo(lua_State * L) // ( int from, int to ) { QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 ); lhs->setFromTo( Util::toInt( L, 2 ), Util::toInt( L, 3 ) ); return 0; }