summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/fontsampler/mainwindow.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-11-09 21:03:52 -0800
committerJake Petroules <jake.petroules@qt.io>2016-11-10 21:17:21 +0000
commit8eb3f586094294ab09a69d98fba374e236b0e095 (patch)
treeb7ff088cc9c4478c4cd65516e5467a6ebcc872f2 /examples/widgets/painting/fontsampler/mainwindow.cpp
parentaba5801a323e33833a619a5d2e99abc598a01b67 (diff)
Fix fontsampler build with QT_NO_PRINTER / QT_NO_PRINTDIALOG
Change-Id: I4495949580846e9b04c8e15a756c0d5a64d69c0c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/widgets/painting/fontsampler/mainwindow.cpp')
-rw-r--r--examples/widgets/painting/fontsampler/mainwindow.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp
index 33d560edf3..394a65b41e 100644
--- a/examples/widgets/painting/fontsampler/mainwindow.cpp
+++ b/examples/widgets/painting/fontsampler/mainwindow.cpp
@@ -214,9 +214,9 @@ QMap<QString, StyleItems> MainWindow::currentPageMap()
return pageMap;
}
-#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
void MainWindow::on_printAction_triggered()
{
+#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
pageMap = currentPageMap();
if (pageMap.count() == 0)
@@ -233,10 +233,12 @@ void MainWindow::on_printAction_triggered()
printer.setFromTo(1, pageMap.keys().count());
printDocument(&printer);
+#endif // QT_NO_PRINTER
}
void MainWindow::printDocument(QPrinter *printer)
{
+#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
printer->setFromTo(1, pageMap.count());
QProgressDialog progress(tr("Preparing font samples..."), tr("&Cancel"),
@@ -265,10 +267,12 @@ void MainWindow::printDocument(QPrinter *printer)
}
painter.end();
+#endif // QT_NO_PRINTER
}
void MainWindow::on_printPreviewAction_triggered()
{
+#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
pageMap = currentPageMap();
if (pageMap.count() == 0)
@@ -279,10 +283,12 @@ void MainWindow::on_printPreviewAction_triggered()
connect(&preview, SIGNAL(paintRequested(QPrinter*)),
this, SLOT(printDocument(QPrinter*)));
preview.exec();
+#endif // QT_NO_PRINTER
}
void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
{
+#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
QString family = pageMap.keys()[index];
StyleItems items = pageMap[family];
@@ -345,5 +351,5 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
}
painter->restore();
-}
#endif // QT_NO_PRINTER
+}