summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/printdialog.cpp15
-rw-r--r--qt-ui/printdialog.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp
index 5652101ff..542590707 100644
--- a/qt-ui/printdialog.cpp
+++ b/qt-ui/printdialog.cpp
@@ -3,6 +3,7 @@
#include <QDebug>
#include <QPushButton>
#include <QVBoxLayout>
+#include <QPrintPreviewDialog>
PrintDialog *PrintDialog::instance()
{
@@ -43,9 +44,15 @@ void PrintDialog::runDialog()
void PrintDialog::printClicked(void)
{
- // temporary
- printer.setOutputFileName("print.pdf");
- printer.setOutputFormat(QPrinter::PdfFormat);
- // ---------
+ // printer.setOutputFileName("print.pdf");
+ // printer.setOutputFormat(QPrinter::PdfFormat);
+ // temporary: use a preview dialog
+ QPrintPreviewDialog previewDialog(&printer, this);
+ QObject::connect(&previewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(onPaintRequested(QPrinter *)));
+ previewDialog.exec();
+}
+
+void PrintDialog::onPaintRequested(QPrinter *printerPtr)
+{
printLayout->print();
}
diff --git a/qt-ui/printdialog.h b/qt-ui/printdialog.h
index b97a318c5..097de9531 100644
--- a/qt-ui/printdialog.h
+++ b/qt-ui/printdialog.h
@@ -24,6 +24,7 @@ private:
private slots:
void printClicked();
+ void onPaintRequested(QPrinter *);
};
#endif