mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Print: add a print preview for testing purposes
Use a QPrintPreviewDialog, while the print logic is WIP. This way Qt will show the print output in a window instead of exporting to a file and opending it manualy. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
20804b16d3
commit
9dc45af915
2 changed files with 12 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QPrintPreviewDialog>
|
||||||
|
|
||||||
PrintDialog *PrintDialog::instance()
|
PrintDialog *PrintDialog::instance()
|
||||||
{
|
{
|
||||||
|
@ -43,9 +44,15 @@ void PrintDialog::runDialog()
|
||||||
|
|
||||||
void PrintDialog::printClicked(void)
|
void PrintDialog::printClicked(void)
|
||||||
{
|
{
|
||||||
// temporary
|
// printer.setOutputFileName("print.pdf");
|
||||||
printer.setOutputFileName("print.pdf");
|
// printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
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();
|
printLayout->print();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ private:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void printClicked();
|
void printClicked();
|
||||||
|
void onPaintRequested(QPrinter *);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue