From: Stefan Bund Date: Tue, 25 Jan 2011 09:58:14 +0000 (+0100) Subject: print functionality X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=855c541d95f16bbe038009fff4f39a8de806523b;p=pykit.git print functionality --- diff --git a/Viewer.cc b/Viewer.cc index 7c726c9..56708ee 100644 --- a/Viewer.cc +++ b/Viewer.cc @@ -16,6 +16,8 @@ #ifdef POPPLER #include "PDFWidget.hh" #endif +#include +#include //#include "Viewer.mpp" #define prefix_ @@ -100,9 +102,19 @@ prefix_ pykit::Viewer::Viewer(QUrl const & url, Publisher * publisher, QWidget * #ifdef POPPLER page()->setPluginFactory(new PDFWebPluginFactory (page()->networkAccessManager(), this)); #endif + connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested())); load(url); } +prefix_ void pykit::Viewer::printRequested() +{ + QPrinter printer; + QPrintDialog printDialog(&printer, this); + if (printDialog.exec() == QPrintDialog::Accepted) { + print(&printer); + } +} + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "Viewer.mpp" diff --git a/Viewer.hh b/Viewer.hh index 21ba371..3634e25 100644 --- a/Viewer.hh +++ b/Viewer.hh @@ -26,6 +26,9 @@ namespace pykit { Q_OBJECT; public: Viewer(QUrl const & url, Publisher * publisher, QWidget * parent = 0); + + private slots: + void printRequested(); }; }