Convert features.printdialog to QT_[REQUIRE_]CONFIG

Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-05-29 17:35:58 +02:00
parent f209215c0d
commit dbeb748de3
30 changed files with 118 additions and 111 deletions

View File

@ -49,10 +49,13 @@
****************************************************************************/
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
#include "scribblearea.h"
@ -167,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21]
void ScribbleArea::print()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);
@ -181,7 +184,7 @@ void ScribbleArea::print()
painter.setWindow(image.rect());
painter.drawImage(0, 0, image);
}
#endif // QT_NO_PRINTER
#endif // QT_CONFIG(printdialog)
}
//! [22]

View File

@ -49,8 +49,13 @@
****************************************************************************/
#include <QtWidgets>
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
#include "licensewizard.h"
@ -364,7 +369,7 @@ void ConclusionPage::setVisible(bool visible)
void ConclusionPage::printButtonClicked()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QPrinter printer;
QPrintDialog dialog(&printer, this);
if (dialog.exec())

View File

@ -50,8 +50,13 @@
#include "view.h"
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
#ifndef QT_NO_OPENGL
#include <QtOpenGL>
#else
@ -259,7 +264,7 @@ void View::toggleAntialiasing()
void View::print()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QPrinter printer;
QPrintDialog dialog(&printer, this);
if (dialog.exec() == QDialog::Accepted) {

View File

@ -53,10 +53,13 @@
#include "pixeldelegate.h"
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
//! [0]
MainWindow::MainWindow()
@ -164,7 +167,7 @@ void MainWindow::openImage(const QString &fileName)
void MainWindow::printImage()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
QMessageBox::StandardButton answer;
answer = QMessageBox::question(this, tr("Large Image Size"),

View File

@ -49,11 +49,16 @@
****************************************************************************/
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#if QT_CONFIG(printpreviewdialog)
#include <QPrintPreviewDialog>
#endif
#endif
#include "spreadsheet.h"
#include "spreadsheetdelegate.h"
@ -637,7 +642,7 @@ QString encode_pos(int row, int col)
void SpreadSheet::print()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printpreviewdialog)
QPrinter printer(QPrinter::ScreenResolution);
QPrintPreviewDialog dlg(&printer);
PrintView view;

View File

@ -50,9 +50,12 @@
//! [0]
#include <QtWidgets>
#ifndef QT_NO_PRINTDIALOG
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QtPrintSupport>
#endif
#endif
#include "mainwindow.h"
//! [0]
@ -125,7 +128,7 @@ void MainWindow::newLetter()
//! [3]
void MainWindow::print()
{
#ifndef QT_NO_PRINTDIALOG
#if QT_CONFIG(printdialog)
QTextDocument *document = textEdit->document();
QPrinter printer;

View File

@ -50,8 +50,15 @@
#include <QtWidgets>
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#if QT_CONFIG(printpreviewdialog)
#include <QPrintPreviewDialog>
#endif
#endif
#endif
#include "mainwindow.h"
@ -270,7 +277,7 @@ void MainWindow::printDocument(QPrinter *printer)
void MainWindow::on_printPreviewAction_triggered()
{
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printpreviewdialog)
pageMap = currentPageMap();
if (pageMap.count() == 0)

View File

@ -52,8 +52,6 @@
#define MAINWINDOW_H
#include "ui_mainwindowbase.h"
#include <QPrinter>
#include <QPrintDialog>
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>

View File

@ -49,10 +49,13 @@
****************************************************************************/
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
#include "detailsdialog.h"
#include "mainwindow.h"
@ -245,7 +248,7 @@ void MainWindow::openDialog()
//! [17]
void MainWindow::printFile()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
//! [18]
QPrinter printer;

View File

@ -71,11 +71,18 @@
#include <QCloseEvent>
#include <QMessageBox>
#include <QMimeData>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printer)
#if QT_CONFIG(printdialog)
#include <QPrintDialog>
#endif
#include <QPrinter>
#if QT_CONFIG(printpreviewdialog)
#include <QPrintPreviewDialog>
#endif
#endif
#endif
#include "textedit.h"
@ -474,7 +481,7 @@ bool TextEdit::fileSaveAs()
void TextEdit::filePrint()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (textEdit->textCursor().hasSelection())
@ -488,7 +495,7 @@ void TextEdit::filePrint()
void TextEdit::filePrintPreview()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printpreviewdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintPreviewDialog preview(&printer, this);
connect(&preview, &QPrintPreviewDialog::paintRequested, this, &TextEdit::printPreview);

View File

@ -49,9 +49,12 @@
****************************************************************************/
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrintDialog>
#endif
#endif
#include "imageviewer.h"
@ -180,7 +183,7 @@ void ImageViewer::print()
//! [5] //! [6]
{
Q_ASSERT(imageLabel->pixmap());
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
//! [6] //! [7]
QPrintDialog dialog(&printer, this);
//! [7] //! [8]

View File

@ -49,10 +49,13 @@
****************************************************************************/
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#if defined(QT_PRINTSUPPORT_LIB)
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
#endif
#include "scribblearea.h"
@ -210,7 +213,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21]
void ScribbleArea::print()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);
@ -224,6 +227,6 @@ void ScribbleArea::print()
painter.setWindow(image.rect());
painter.drawImage(0, 0, image);
}
#endif // QT_NO_PRINTER
#endif // QT_CONFIG(printdialog)
}
//! [22]

View File

@ -1,43 +1,46 @@
# Qt dialogs module
HEADERS += \
INCLUDEPATH += $$PWD
qtConfig(printdialog) {
HEADERS += \
dialogs/qabstractprintdialog.h \
dialogs/qabstractprintdialog_p.h \
dialogs/qpagesetupdialog_p.h \
dialogs/qpagesetupdialog.h \
dialogs/qprintdialog.h
osx {
OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \
dialogs/qprintdialog_mac.mm
LIBS_PRIVATE += -framework AppKit
}
macos {
OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \
dialogs/qprintdialog_mac.mm
LIBS_PRIVATE += -framework AppKit
}
win32 {
SOURCES += dialogs/qpagesetupdialog_win.cpp \
dialogs/qprintdialog_win.cpp
}
win32 {
SOURCES += dialogs/qpagesetupdialog_win.cpp \
dialogs/qprintdialog_win.cpp
}
unix:!mac {
INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/printsupport/cups
HEADERS += dialogs/qpagesetupdialog_unix_p.h
SOURCES += dialogs/qprintdialog_unix.cpp \
dialogs/qpagesetupdialog_unix.cpp
FORMS += dialogs/qprintsettingsoutput.ui \
dialogs/qprintwidget.ui \
dialogs/qprintpropertieswidget.ui
}
unix:!darwin {
INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/printsupport/cups
HEADERS += dialogs/qpagesetupdialog_unix_p.h
SOURCES += dialogs/qprintdialog_unix.cpp \
dialogs/qpagesetupdialog_unix.cpp
FORMS += dialogs/qprintsettingsoutput.ui \
dialogs/qprintwidget.ui \
dialogs/qprintpropertieswidget.ui
}
INCLUDEPATH += $$PWD
SOURCES += \
SOURCES += \
dialogs/qabstractprintdialog.cpp \
dialogs/qpagesetupdialog.cpp
FORMS += dialogs/qpagesetupwidget.ui
RESOURCES += dialogs/qprintdialog.qrc
}
qtConfig(printpreviewdialog) {
HEADERS += dialogs/qprintpreviewdialog.h
SOURCES += dialogs/qprintpreviewdialog.cpp
}
FORMS += dialogs/qpagesetupwidget.ui
RESOURCES += dialogs/qprintdialog.qrc

View File

@ -43,8 +43,6 @@
#include "qprinter.h"
#include "private/qprinter_p.h"
#ifndef QT_NO_PRINTDIALOG
QT_BEGIN_NAMESPACE
// hack
@ -497,5 +495,3 @@ void QPrintDialog::open(QObject *receiver, const char *member)
}
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG

View File

@ -42,12 +42,11 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QAbstractPrintDialogPrivate;
class QPrinter;
@ -120,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions)
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif // QABSTRACTPRINTDIALOG_H

View File

@ -53,14 +53,12 @@
#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTDIALOG
#include "private/qdialog_p.h"
#include "QtPrintSupport/qabstractprintdialog.h"
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(printdialog);
#ifndef QT_NO_PRINTER
QT_BEGIN_NAMESPACE
class QPrinter;
class QPrinterPrivate;
@ -92,10 +90,6 @@ public:
int maxPage;
};
#endif //QT_NO_PRINTER
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif // QABSTRACTPRINTDIALOG_P_H

View File

@ -42,8 +42,6 @@
#include <QtPrintSupport/qprinter.h>
#ifndef QT_NO_PRINTDIALOG
QT_BEGIN_NAMESPACE
/*!
@ -183,5 +181,3 @@ void QPageSetupDialog::done(int result)
}
QT_END_NAMESPACE
#endif

View File

@ -42,12 +42,11 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#ifndef QT_NO_PRINTDIALOG
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QPrinter;
class QPageSetupDialogPrivate;
@ -77,6 +76,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif // QPAGESETUPDIALOG_H

View File

@ -42,7 +42,6 @@
#include "qpagesetupdialog.h"
#ifndef QT_NO_PRINTDIALOG
#include "qpagesetupdialog_p.h"
#include <qpa/qplatformnativeinterface.h>
@ -222,5 +221,3 @@ int QPageSetupDialog::exec()
}
QT_END_NAMESPACE
#endif /* QT_NO_PRINTDIALOG */

View File

@ -54,14 +54,14 @@
#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTDIALOG
#include "private/qdialog_p.h"
#include "qbytearray.h"
#include "qpagesetupdialog.h"
#include "qpointer.h"
QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QPrinter;
@ -83,6 +83,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif // QPAGESETUPDIALOG_P_H

View File

@ -39,7 +39,6 @@
#include "qpagesetupdialog.h"
#ifndef QT_NO_PRINTDIALOG
#include "qpagesetupdialog_unix_p.h"
#include <private/qpagesetupdialog_p.h>
@ -644,5 +643,3 @@ int QPageSetupDialog::exec()
QT_END_NAMESPACE
#include "moc_qpagesetupdialog.cpp"
#endif // QT_NO_PRINTDIALOG

View File

@ -53,14 +53,14 @@
#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTDIALOG
#include "qprinter.h"
#include <QtGui/qpagelayout.h>
#include <ui_qpagesetupwidget.h>
QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QPrinter;
@ -106,5 +106,4 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif

View File

@ -39,7 +39,6 @@
#include "qpagesetupdialog.h"
#ifndef QT_NO_PRINTDIALOG
#include <qapplication.h>
#include "../kernel/qprintengine_win_p.h"
@ -168,4 +167,3 @@ void QPageSetupDialog::setVisible(bool visible)
}
QT_END_NAMESPACE
#endif

View File

@ -42,12 +42,11 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#ifndef QT_NO_PRINTDIALOG
#include <QtPrintSupport/qabstractprintdialog.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QPrintDialogPrivate;
class QPushButton;
@ -104,6 +103,4 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_PRINTDIALOG
#endif // QPRINTDIALOG_H

View File

@ -48,8 +48,6 @@
#include <QtPrintSupport/qprintengine.h>
#include <qpa/qplatformprintdevice.h>
#ifndef QT_NO_PRINTDIALOG
QT_BEGIN_NAMESPACE
extern qreal qt_pointMultiplier(QPageLayout::Unit unit);
@ -358,5 +356,3 @@ void QPrintDialog::setVisible(bool visible)
QT_END_NAMESPACE
#include "moc_qprintdialog.cpp"
#endif // QT_NO_PRINTDIALOG

View File

@ -40,8 +40,6 @@
#include "qplatformdefs.h"
#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTDIALOG
#include "private/qabstractprintdialog_p.h"
#include <QtWidgets/qmessagebox.h>
#include "qprintdialog.h"
@ -983,6 +981,3 @@ QT_END_NAMESPACE
#include "moc_qprintdialog.cpp"
#include "qprintdialog_unix.moc"
#endif // QT_NO_PRINTDIALOG

View File

@ -39,8 +39,6 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#ifndef QT_NO_PRINTDIALOG
#include "qprintdialog.h"
#include <qwidget.h>
@ -308,5 +306,3 @@ void QPrintDialog::setVisible(bool visible)
QT_END_NAMESPACE
#include "moc_qprintdialog.cpp"
#endif // QT_NO_PRINTDIALOG

View File

@ -50,7 +50,8 @@
#include <QtGui>
#include <QtWidgets>
#ifndef QT_NO_PRINTER
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <QPrinter>
#include <QPrintDialog>
#endif
@ -98,7 +99,7 @@ private slots:
}
void printFile() {
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
#if QT_CONFIG(printdialog)
//! [1]
QPrinter printer;

View File

@ -40,7 +40,9 @@
#include "qplatformprintdevice.h"
#include "qprintdevice_p.h"
#if QT_CONFIG(printdialog)
#include "qprintdialog.h"
#endif
#include <QtGui/qpagelayout.h>

View File

@ -31,14 +31,17 @@
#include <qcoreapplication.h>
#include <qdebug.h>
#include <QtPrintSupport/qtprintsupportglobal.h>
#if QT_CONFIG(printdialog)
#include <qabstractprintdialog.h>
#include <qprinter.h>
#endif
class tst_QAbstractPrintDialog : public QObject
{
Q_OBJECT
#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
#if !QT_CONFIG(printdialog)
public slots:
void initTestCase();
#else
@ -49,7 +52,7 @@ private slots:
#endif
};
#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
#if !QT_CONFIG(printdialog)
void tst_QAbstractPrintDialog::initTestCase()
{
QSKIP("This test requires printing and print dialog support");