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 <QFileDialog>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#if defined(QT_PRINTSUPPORT_LIB)
|
||||||
|
#include <QtPrintSupport/qtprintsupportglobal.h>
|
||||||
|
#if QT_CONFIG(printer)
|
||||||
|
#if QT_CONFIG(printdialog)
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
|
#endif // QT_CONFIG(printdialog)
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#endif // QT_CONFIG(printer)
|
||||||
|
#endif // QT_PRINTSUPPORT_LIB
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
|
|
||||||
@ -136,11 +143,15 @@ void Notepad::on_actionSave_as_triggered()
|
|||||||
|
|
||||||
void Notepad::on_actionPrint_triggered()
|
void Notepad::on_actionPrint_triggered()
|
||||||
{
|
{
|
||||||
|
#if QT_CONFIG(printer)
|
||||||
QPrinter printDev;
|
QPrinter printDev;
|
||||||
|
#if QT_CONFIG(printdialog)
|
||||||
QPrintDialog dialog(&printDev, this);
|
QPrintDialog dialog(&printDev, this);
|
||||||
if (dialog.exec() == QDialog::Rejected)
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
|
#endif // QT_CONFIG(printdialog)
|
||||||
ui->textEdit->print(&printDev);
|
ui->textEdit->print(&printDev);
|
||||||
|
#endif // QT_CONFIG(printer)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad::on_actionExit_triggered()
|
void Notepad::on_actionExit_triggered()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = notepad
|
TARGET = notepad
|
||||||
|
|
||||||
QT += printsupport
|
qtHaveModule(printsupport): QT += printsupport
|
||||||
requires(qtConfig(fontdialog))
|
requires(qtConfig(fontdialog))
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user