diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/painting/fontsampler/mainwindow.cpp | 18 | ||||
-rw-r--r-- | examples/widgets/painting/fontsampler/mainwindow.h | 5 |
2 files changed, 14 insertions, 9 deletions
diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 5aecea4968..192ffbd369 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -49,7 +49,9 @@ ****************************************************************************/ #include <QtWidgets> +#if defined(QT_PRINTSUPPORT_LIB) #include <QPrintPreviewDialog> +#endif #include "mainwindow.h" @@ -212,7 +214,7 @@ QMap<QString, StyleItems> MainWindow::currentPageMap() void MainWindow::on_printAction_triggered() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) pageMap = currentPageMap(); if (pageMap.count() == 0) @@ -229,12 +231,12 @@ void MainWindow::on_printAction_triggered() printer.setFromTo(1, pageMap.keys().count()); printDocument(&printer); -#endif // QT_NO_PRINTER +#endif } void MainWindow::printDocument(QPrinter *printer) { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) printer->setFromTo(1, pageMap.count()); QProgressDialog progress(tr("Preparing font samples..."), tr("&Cancel"), @@ -263,12 +265,12 @@ void MainWindow::printDocument(QPrinter *printer) } painter.end(); -#endif // QT_NO_PRINTER +#endif } void MainWindow::on_printPreviewAction_triggered() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) pageMap = currentPageMap(); if (pageMap.count() == 0) @@ -279,12 +281,12 @@ void MainWindow::on_printPreviewAction_triggered() connect(&preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(printDocument(QPrinter*))); preview.exec(); -#endif // QT_NO_PRINTER +#endif } void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) QString family = pageMap.keys()[index]; StyleItems items = pageMap[family]; @@ -347,5 +349,5 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) } painter->restore(); -#endif // QT_NO_PRINTER +#endif } diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h index 6d73e84ea3..8f59e1021b 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.h +++ b/examples/widgets/painting/fontsampler/mainwindow.h @@ -55,6 +55,9 @@ #include <QPrinter> #include <QPrintDialog> +#if defined(QT_PRINTSUPPORT_LIB) +#include <QtPrintSupport/qtprintsupportglobal.h> +#endif QT_BEGIN_NAMESPACE class QPrinter; class QTextEdit; @@ -74,9 +77,9 @@ public: public slots: void on_clearAction_triggered(); void on_markAction_triggered(); + void on_unmarkAction_triggered(); void on_printAction_triggered(); void on_printPreviewAction_triggered(); - void on_unmarkAction_triggered(); void printDocument(QPrinter *printer); void printPage(int index, QPainter *painter, QPrinter *printer); void showFont(QTreeWidgetItem *item); |