diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2018-01-15 08:59:09 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2018-01-22 08:27:26 +0000 |
commit | 6c3f864ec00c4e20a05f60032048e9fe2c7e116c (patch) | |
tree | 30439831d383cdd3b283c3aa989889a28b2d9d32 /examples | |
parent | 50e8acd06be8ca45cdf82f2a0ac66f0efd919c34 (diff) | |
download | qtbase-6c3f864ec00c4e20a05f60032048e9fe2c7e116c.tar.gz |
examples: Fix notepad example for configurations without printsupport
Task-number: QTBUG-65735
Change-Id: I7e0d19de4ac92603f2fd033007343f20a408618a
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/tutorials/notepad/notepad.cpp | 11 | ||||
-rw-r--r-- | examples/widgets/tutorials/notepad/notepad.pro | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/examples/widgets/tutorials/notepad/notepad.cpp b/examples/widgets/tutorials/notepad/notepad.cpp index b4f6cf7f8f..44d8597cb7 100644 --- a/examples/widgets/tutorials/notepad/notepad.cpp +++ b/examples/widgets/tutorials/notepad/notepad.cpp @@ -52,8 +52,15 @@ #include <QFileDialog> #include <QTextStream> #include <QMessageBox> +#if defined(QT_PRINTSUPPORT_LIB) +#include <QtPrintSupport/qtprintsupportglobal.h> +#if QT_CONFIG(printer) +#if QT_CONFIG(printdialog) #include <QPrintDialog> +#endif // QT_CONFIG(printdialog) #include <QPrinter> +#endif // QT_CONFIG(printer) +#endif // QT_PRINTSUPPORT_LIB #include <QFont> #include <QFontDialog> @@ -136,11 +143,15 @@ void Notepad::on_actionSave_as_triggered() void Notepad::on_actionPrint_triggered() { +#if QT_CONFIG(printer) QPrinter printDev; +#if QT_CONFIG(printdialog) QPrintDialog dialog(&printDev, this); if (dialog.exec() == QDialog::Rejected) return; +#endif // QT_CONFIG(printdialog) ui->textEdit->print(&printDev); +#endif // QT_CONFIG(printer) } void Notepad::on_actionExit_triggered() diff --git a/examples/widgets/tutorials/notepad/notepad.pro b/examples/widgets/tutorials/notepad/notepad.pro index a552dacf00..6451f22735 100644 --- a/examples/widgets/tutorials/notepad/notepad.pro +++ b/examples/widgets/tutorials/notepad/notepad.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = notepad -QT += printsupport +qtHaveModule(printsupport): QT += printsupport requires(qtConfig(fontdialog)) SOURCES += \ |