summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/fontsampler/mainwindow.cpp
diff options
context:
space:
mode:
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 06ffac3728..5aecea4968 100644
--- a/examples/widgets/painting/fontsampler/mainwindow.cpp
+++ b/examples/widgets/painting/fontsampler/mainwindow.cpp
@@ -210,9 +210,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)
@@ -229,10 +229,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"),
@@ -261,10 +263,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)
@@ -275,10 +279,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];
@@ -341,5 +347,5 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
}
painter->restore();
-}
#endif // QT_NO_PRINTER
+}