summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-15 21:19:50 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-02-15 21:19:50 +0000
commit1ef03f69e8416a70efd14df09e1231ce0bc00ea9 (patch)
tree7edc868dff999b4f9123bf87e92c9a7cb72e9db1 /examples
parent23eab78f510a9cfb050980f522dc23409e23fbdb (diff)
parentbb0fec8057dd11c359bfcb4aefb66d9b210f52a6 (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into 5.11" into refs/staging/5.11
Diffstat (limited to 'examples')
-rw-r--r--examples/gui/rasterwindow/rasterwindow.cpp1
-rw-r--r--examples/widgets/tutorials/notepad/notepad.cpp11
-rw-r--r--examples/widgets/tutorials/notepad/notepad.pro2
3 files changed, 13 insertions, 1 deletions
diff --git a/examples/gui/rasterwindow/rasterwindow.cpp b/examples/gui/rasterwindow/rasterwindow.cpp
index 68d1d7f524..3eacd20145 100644
--- a/examples/gui/rasterwindow/rasterwindow.cpp
+++ b/examples/gui/rasterwindow/rasterwindow.cpp
@@ -111,6 +111,7 @@ void RasterWindow::renderNow()
painter.fillRect(0, 0, width(), height(), Qt::white);
render(&painter);
+ painter.end();
m_backingStore->endPaint();
m_backingStore->flush(rect);
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 += \