examples: Fix notepad example for configurations without printsupport
Task-number: QTBUG-65735 Change-Id: I7e0d19de4ac92603f2fd033007343f20a408618a Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
This commit is contained in:
parent
50e8acd06b
commit
6c3f864ec0
@ -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()
|
||||
|
@ -1,7 +1,7 @@
|
||||
TEMPLATE = app
|
||||
TARGET = notepad
|
||||
|
||||
QT += printsupport
|
||||
qtHaveModule(printsupport): QT += printsupport
|
||||
requires(qtConfig(fontdialog))
|
||||
|
||||
SOURCES += \
|
||||
|
Loading…
x
Reference in New Issue
Block a user