diff options
| author | Martin Jansa <Martin.Jansa@gmail.com> | 2017-08-19 11:24:55 +0200 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-08-20 19:30:06 +0200 |
| commit | a0b2220b5e08a7914d55afec0ff6e2316cb47404 (patch) | |
| tree | 97d954f24c93b93005716d6c4169e7862461fa6d /recipes-qt/qt5/qtwebengine | |
| parent | 969f1f80bf255498abbec6886d443670c20a79c8 (diff) | |
| download | meta-qt5-a0b2220b5e08a7914d55afec0ff6e2316cb47404.tar.gz | |
qtwebengine: add a fix for building demobrowser without printing support
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'recipes-qt/qt5/qtwebengine')
| -rw-r--r-- | recipes-qt/qt5/qtwebengine/0005-Always-compile-QWebEnginePage-print.patch | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtwebengine/0005-Always-compile-QWebEnginePage-print.patch b/recipes-qt/qt5/qtwebengine/0005-Always-compile-QWebEnginePage-print.patch new file mode 100644 index 00000000..c63086d5 --- /dev/null +++ b/recipes-qt/qt5/qtwebengine/0005-Always-compile-QWebEnginePage-print.patch | |||
| @@ -0,0 +1,241 @@ | |||
| 1 | From a8c0deca850ca519b3f146c71492a8f42a33dd84 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?J=C3=BCri=20Valdmann?= <juri.valdmann@qt.io> | ||
| 3 | Date: Tue, 20 Jun 2017 15:36:43 +0200 | ||
| 4 | Subject: [PATCH] Always compile QWebEnginePage::print | ||
| 5 | |||
| 6 | - Remove two out of five layers of ifdefs around and inside this method. | ||
| 7 | - Now always compiled but will yield an error if printing is disabled. | ||
| 8 | - Remove printing-related ifdefs from demobrowser. | ||
| 9 | |||
| 10 | Task-number: QTBUG-61510 | ||
| 11 | Change-Id: I79781189d3d3fb62db0a2216b2b989e3fa1d1f86 | ||
| 12 | Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> | ||
| 13 | Reviewed-by: Rolf Eike Beer <eb@emlix.com> | ||
| 14 | --- | ||
| 15 | examples/webenginewidgets/demobrowser/browsermainwindow.cpp | 12 ------------ | ||
| 16 | examples/webenginewidgets/demobrowser/browsermainwindow.h | 6 ------ | ||
| 17 | examples/webenginewidgets/demobrowser/printtopdfdialog.cpp | 7 ------- | ||
| 18 | src/webenginewidgets/api/qwebenginepage.cpp | 10 ++-------- | ||
| 19 | src/webenginewidgets/api/qwebenginepage.h | 8 -------- | ||
| 20 | 5 files changed, 2 insertions(+), 41 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp | ||
| 23 | index 327d7a9d..14d49f7f 100644 | ||
| 24 | --- a/examples/webenginewidgets/demobrowser/browsermainwindow.cpp | ||
| 25 | +++ b/examples/webenginewidgets/demobrowser/browsermainwindow.cpp | ||
| 26 | @@ -109,9 +109,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) | ||
| 27 | , m_historyForward(0) | ||
| 28 | , m_stop(0) | ||
| 29 | , m_reload(0) | ||
| 30 | -#ifndef QT_NO_PRINTER | ||
| 31 | , m_currentPrinter(nullptr) | ||
| 32 | -#endif | ||
| 33 | { | ||
| 34 | setToolButtonStyle(Qt::ToolButtonFollowStyle); | ||
| 35 | setAttribute(Qt::WA_DeleteOnClose, true); | ||
| 36 | @@ -312,9 +310,7 @@ void BrowserMainWindow::setupMenu() | ||
| 37 | #if defined(QWEBENGINEPAGE_PRINT) | ||
| 38 | fileMenu->addAction(tr("P&rint Preview..."), this, SLOT(slotFilePrintPreview())); | ||
| 39 | #endif | ||
| 40 | -#ifndef QT_NO_PRINTER | ||
| 41 | fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint()), QKeySequence::Print); | ||
| 42 | -#endif | ||
| 43 | fileMenu->addAction(tr("&Print to PDF..."), this, SLOT(slotFilePrintToPDF())); | ||
| 44 | fileMenu->addSeparator(); | ||
| 45 | |||
| 46 | @@ -702,23 +698,19 @@ void BrowserMainWindow::slotFileOpen() | ||
| 47 | |||
| 48 | void BrowserMainWindow::slotFilePrintPreview() | ||
| 49 | { | ||
| 50 | -#ifndef QT_NO_PRINTPREVIEWDIALOG | ||
| 51 | if (!currentTab()) | ||
| 52 | return; | ||
| 53 | QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this); | ||
| 54 | connect(dialog, SIGNAL(paintRequested(QPrinter*)), | ||
| 55 | currentTab(), SLOT(print(QPrinter*))); | ||
| 56 | dialog->exec(); | ||
| 57 | -#endif | ||
| 58 | } | ||
| 59 | |||
| 60 | void BrowserMainWindow::slotFilePrint() | ||
| 61 | { | ||
| 62 | -#ifndef QT_NO_PRINTER | ||
| 63 | if (!currentTab()) | ||
| 64 | return; | ||
| 65 | printRequested(currentTab()->page()); | ||
| 66 | -#endif | ||
| 67 | } | ||
| 68 | |||
| 69 | void BrowserMainWindow::slotHandlePdfPrinted(const QByteArray& result) | ||
| 70 | @@ -751,7 +743,6 @@ void BrowserMainWindow::slotFilePrintToPDF() | ||
| 71 | currentTab()->page()->printToPdf(invoke(this, &BrowserMainWindow::slotHandlePdfPrinted), dialog->pageLayout()); | ||
| 72 | } | ||
| 73 | |||
| 74 | -#ifndef QT_NO_PRINTER | ||
| 75 | void BrowserMainWindow::slotHandlePagePrinted(bool result) | ||
| 76 | { | ||
| 77 | Q_UNUSED(result); | ||
| 78 | @@ -763,7 +754,6 @@ void BrowserMainWindow::slotHandlePagePrinted(bool result) | ||
| 79 | |||
| 80 | void BrowserMainWindow::printRequested(QWebEnginePage *page) | ||
| 81 | { | ||
| 82 | -#ifndef QT_NO_PRINTDIALOG | ||
| 83 | if (m_currentPrinter) | ||
| 84 | return; | ||
| 85 | m_currentPrinter = new QPrinter(); | ||
| 86 | @@ -774,9 +764,7 @@ void BrowserMainWindow::printRequested(QWebEnginePage *page) | ||
| 87 | return; | ||
| 88 | } | ||
| 89 | page->print(m_currentPrinter, invoke(this, &BrowserMainWindow::slotHandlePagePrinted)); | ||
| 90 | -#endif | ||
| 91 | } | ||
| 92 | -#endif | ||
| 93 | |||
| 94 | void BrowserMainWindow::slotPrivateBrowsing() | ||
| 95 | { | ||
| 96 | diff --git a/examples/webenginewidgets/demobrowser/browsermainwindow.h b/examples/webenginewidgets/demobrowser/browsermainwindow.h | ||
| 97 | index 91e1c1d2..5bbbb292 100644 | ||
| 98 | --- a/examples/webenginewidgets/demobrowser/browsermainwindow.h | ||
| 99 | +++ b/examples/webenginewidgets/demobrowser/browsermainwindow.h | ||
| 100 | @@ -56,9 +56,7 @@ | ||
| 101 | #include <QtCore/QUrl> | ||
| 102 | |||
| 103 | QT_BEGIN_NAMESPACE | ||
| 104 | -#ifndef QT_NO_PRINTER | ||
| 105 | class QPrinter; | ||
| 106 | -#endif | ||
| 107 | class QWebEnginePage; | ||
| 108 | QT_END_NAMESPACE | ||
| 109 | |||
| 110 | @@ -142,10 +140,8 @@ private slots: | ||
| 111 | void slotSwapFocus(); | ||
| 112 | void slotHandlePdfPrinted(const QByteArray&); | ||
| 113 | |||
| 114 | -#ifndef QT_NO_PRINTER | ||
| 115 | void slotHandlePagePrinted(bool result); | ||
| 116 | void printRequested(QWebEnginePage *page); | ||
| 117 | -#endif | ||
| 118 | void geometryChangeRequested(const QRect &geometry); | ||
| 119 | void updateToolbarActionText(bool visible); | ||
| 120 | void updateBookmarksToolbarActionText(bool visible); | ||
| 121 | @@ -180,9 +176,7 @@ private: | ||
| 122 | QAction *m_restoreLastSession; | ||
| 123 | QAction *m_addBookmark; | ||
| 124 | |||
| 125 | -#ifndef QT_NO_PRINTER | ||
| 126 | QPrinter *m_currentPrinter; | ||
| 127 | -#endif | ||
| 128 | |||
| 129 | QIcon m_reloadIcon; | ||
| 130 | QIcon m_stopIcon; | ||
| 131 | diff --git a/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp b/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp | ||
| 132 | index 0f3b1765..50a8bb91 100644 | ||
| 133 | --- a/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp | ||
| 134 | +++ b/examples/webenginewidgets/demobrowser/printtopdfdialog.cpp | ||
| 135 | @@ -52,10 +52,8 @@ | ||
| 136 | #include "ui_printtopdfdialog.h" | ||
| 137 | |||
| 138 | #include <QtCore/QDir> | ||
| 139 | -#ifndef QT_NO_PRINTER | ||
| 140 | #include <QtPrintSupport/QPageSetupDialog> | ||
| 141 | #include <QtPrintSupport/QPrinter> | ||
| 142 | -#endif // QT_NO_PRINTER | ||
| 143 | #include <QtWidgets/QFileDialog> | ||
| 144 | |||
| 145 | PrintToPdfDialog::PrintToPdfDialog(const QString &filePath, QWidget *parent) : | ||
| 146 | @@ -66,11 +64,8 @@ PrintToPdfDialog::PrintToPdfDialog(const QString &filePath, QWidget *parent) : | ||
| 147 | ui->setupUi(this); | ||
| 148 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | ||
| 149 | connect(ui->chooseFilePathButton, &QToolButton::clicked, this, &PrintToPdfDialog::onChooseFilePathButtonClicked); | ||
| 150 | -#ifndef QT_NO_PRINTER | ||
| 151 | connect(ui->choosePageLayoutButton, &QToolButton::clicked, this, &PrintToPdfDialog::onChoosePageLayoutButtonClicked); | ||
| 152 | -#else | ||
| 153 | ui->choosePageLayoutButton->hide(); | ||
| 154 | -#endif // QT_NO_PRINTER | ||
| 155 | updatePageLayoutLabel(); | ||
| 156 | setFilePath(filePath); | ||
| 157 | } | ||
| 158 | @@ -82,7 +77,6 @@ PrintToPdfDialog::~PrintToPdfDialog() | ||
| 159 | |||
| 160 | void PrintToPdfDialog::onChoosePageLayoutButtonClicked() | ||
| 161 | { | ||
| 162 | -#ifndef QT_NO_PRINTER | ||
| 163 | QPrinter printer; | ||
| 164 | printer.setPageLayout(currentPageLayout); | ||
| 165 | |||
| 166 | @@ -92,7 +86,6 @@ void PrintToPdfDialog::onChoosePageLayoutButtonClicked() | ||
| 167 | currentPageLayout.setPageSize(printer.pageLayout().pageSize()); | ||
| 168 | currentPageLayout.setOrientation(printer.pageLayout().orientation()); | ||
| 169 | updatePageLayoutLabel(); | ||
| 170 | -#endif // QT_NO_PRINTER | ||
| 171 | } | ||
| 172 | |||
| 173 | void PrintToPdfDialog::onChooseFilePathButtonClicked() | ||
| 174 | diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 175 | index 82720ae3..20d3268c 100644 | ||
| 176 | --- a/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 177 | +++ b/src/webenginewidgets/api/qwebenginepage.cpp | ||
| 178 | @@ -80,11 +80,9 @@ | ||
| 179 | #include <QMenu> | ||
| 180 | #include <QMessageBox> | ||
| 181 | #include <QMimeData> | ||
| 182 | -#if defined(QT_PRINTSUPPORT_LIB) | ||
| 183 | -#ifndef QT_NO_PRINTER | ||
| 184 | +#ifdef ENABLE_PRINTING | ||
| 185 | #include <QPrinter> | ||
| 186 | -#endif //QT_NO_PRINTER | ||
| 187 | -#endif //QT_PRINTSUPPORT_LIB | ||
| 188 | +#endif | ||
| 189 | #include <QStandardPaths> | ||
| 190 | #include <QStyle> | ||
| 191 | #include <QTimer> | ||
| 192 | @@ -2052,8 +2050,6 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback<const QByteArray&> &res | ||
| 193 | #endif // if defined(ENABLE_PDF) | ||
| 194 | } | ||
| 195 | |||
| 196 | -#if defined(QT_PRINTSUPPORT_LIB) | ||
| 197 | -#ifndef QT_NO_PRINTER | ||
| 198 | /*! | ||
| 199 | \fn void QWebEnginePage::print(QPrinter *printer, FunctorOrLambda resultCallback) | ||
| 200 | Renders the current content of the page into a temporary PDF document, then prints it using \a printer. | ||
| 201 | @@ -2090,8 +2086,6 @@ void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback<bool> &re | ||
| 202 | d->m_callbacks.invokeDirectly(resultCallback, false); | ||
| 203 | #endif // if defined(ENABLE_PDF) | ||
| 204 | } | ||
| 205 | -#endif // if defined(QT_NO_PRINTER) | ||
| 206 | -#endif // if defined(QT_PRINTSUPPORT_LIB) | ||
| 207 | |||
| 208 | /*! | ||
| 209 | \since 5.7 | ||
| 210 | diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h | ||
| 211 | index c7d5a19e..5619639c 100644 | ||
| 212 | --- a/src/webenginewidgets/api/qwebenginepage.h | ||
| 213 | +++ b/src/webenginewidgets/api/qwebenginepage.h | ||
| 214 | @@ -55,11 +55,7 @@ | ||
| 215 | |||
| 216 | QT_BEGIN_NAMESPACE | ||
| 217 | class QMenu; | ||
| 218 | -#if defined(QT_PRINTSUPPORT_LIB) | ||
| 219 | -#ifndef QT_NO_PRINTER | ||
| 220 | class QPrinter; | ||
| 221 | -#endif // QT_NO_PRINTER | ||
| 222 | -#endif // QT_PRINTSUPPORT_LIB | ||
| 223 | |||
| 224 | class QWebChannel; | ||
| 225 | class QWebEngineContextMenuData; | ||
| 226 | @@ -294,15 +290,11 @@ public: | ||
| 227 | void printToPdf(const QWebEngineCallback<const QByteArray&> &resultCallback, const QPageLayout &layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF())); | ||
| 228 | #endif | ||
| 229 | |||
| 230 | -#if defined(QT_PRINTSUPPORT_LIB) | ||
| 231 | -#ifndef QT_NO_PRINTER | ||
| 232 | #ifdef Q_QDOC | ||
| 233 | void print(QPrinter *printer, FunctorOrLambda resultCallback); | ||
| 234 | #else | ||
| 235 | void print(QPrinter *printer, const QWebEngineCallback<bool> &resultCallback); | ||
| 236 | #endif // QDOC | ||
| 237 | -#endif // QT_NO_PRINTER | ||
| 238 | -#endif // QT_PRINTSUPPORT_LIB | ||
| 239 | |||
| 240 | const QWebEngineContextMenuData &contextMenuData() const; | ||
| 241 | |||
