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 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 +} diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h index f39e1b1916..e79da07326 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.h +++ b/examples/widgets/painting/fontsampler/mainwindow.h @@ -72,15 +72,11 @@ public: public slots: void on_clearAction_triggered(); void on_markAction_triggered(); -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) void on_printAction_triggered(); void on_printPreviewAction_triggered(); -#endif void on_unmarkAction_triggered(); -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) void printDocument(QPrinter *printer); void printPage(int index, QPainter *painter, QPrinter *printer); -#endif void showFont(QTreeWidgetItem *item); void updateStyles(QTreeWidgetItem *item, int column);