iOS: Enable the Qt Print Support module
The print support module was disabled for the initial port of Qt for iOS due to the lack of a native print backend and native print dialogs, as we have on macOS. However, even lacking these we should be able to offer the print to PDF feature, with widget based print dialogs. We can do so by opting in to the generic Unix print dialogs and backends, as these do not have a hard dependency on CUPS. Longer term we should adopt UIPrintInteractionController, UIPrinterPickerController, and UIPrinter, but that's a bigger task. [ChangeLog[iOS] The Qt Print Support module is now enabled, allowing printing to PDF. Printing to system provided printers are not yet supported. Fixes: QTBUG-125581 Change-Id: I5bc143e47c7277b3cea52760672ac4d0c8a7a898 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
d67d49f45e
commit
bee9de0452
@ -179,7 +179,7 @@ qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND WIN3
|
||||
dialogs/qprintdialog_win.cpp
|
||||
)
|
||||
|
||||
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND UNIX AND NOT APPLE
|
||||
qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog AND UNIX AND NOT MACOS
|
||||
SOURCES
|
||||
dialogs/qpagesetupdialog_unix.cpp dialogs/qpagesetupdialog_unix_p.h
|
||||
dialogs/qprintdialog_unix.cpp
|
||||
|
@ -40,7 +40,7 @@ qt_feature("printer" PUBLIC
|
||||
SECTION "Painting"
|
||||
LABEL "QPrinter"
|
||||
PURPOSE "Provides a printer backend of QPainter."
|
||||
CONDITION NOT UIKIT AND QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf
|
||||
CONDITION QT_FEATURE_picture AND QT_FEATURE_temporaryfile AND QT_FEATURE_pdf
|
||||
)
|
||||
qt_feature_definition("printer" "QT_NO_PRINTER" NEGATE VALUE "1")
|
||||
qt_feature("printpreviewwidget" PUBLIC
|
||||
|
@ -100,7 +100,7 @@ void QPageSetupDialog::open(QObject *receiver, const char *member)
|
||||
QDialog::open();
|
||||
}
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
||||
/*! \fn void QPageSetupDialog::setVisible(bool visible)
|
||||
\reimp
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
explicit QPageSetupDialog(QWidget *parent = nullptr);
|
||||
~QPageSetupDialog();
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(Q_QDOC)
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) || defined(Q_QDOC)
|
||||
void setVisible(bool visible) override;
|
||||
#endif
|
||||
int exec() override;
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
~QPrintDialog();
|
||||
|
||||
int exec() override;
|
||||
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||
virtual void accept() override;
|
||||
#endif
|
||||
void done(int result) override;
|
||||
@ -55,7 +55,7 @@ Q_SIGNALS:
|
||||
void accepted(QPrinter *printer);
|
||||
|
||||
private:
|
||||
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
|
||||
#if QT_CONFIG(messagebox)
|
||||
|
@ -250,7 +250,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
|
||||
QWidget *pageEdit = new QWidget(toolbar);
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout;
|
||||
vboxLayout->setContentsMargins(0, 0, 0, 0);
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_OS_MACOS
|
||||
// We query the widgets about their size and then we fix the size.
|
||||
// This should do the trick for the laying out part...
|
||||
QSize pageNumEditSize, pageNumLabelSize;
|
||||
@ -260,7 +260,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
|
||||
pageNumLabel->resize(pageNumLabelSize);
|
||||
#endif
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_OS_MACOS
|
||||
// We have to change the growth policy in Mac.
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
#endif
|
||||
@ -310,7 +310,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
|
||||
q->setWindowTitle(caption);
|
||||
|
||||
if (!printer->isValid()
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_APPLE)
|
||||
|| printer->outputFormat() != QPrinter::NativeFormat
|
||||
#endif
|
||||
)
|
||||
@ -539,7 +539,7 @@ void QPrintPreviewDialogPrivate::_q_print()
|
||||
{
|
||||
Q_Q(QPrintPreviewDialog);
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_APPLE)
|
||||
if (printer->outputFormat() != QPrinter::NativeFormat) {
|
||||
QString title = QCoreApplication::translate("QPrintPreviewDialog", "Export to PDF");
|
||||
QString suffix = ".pdf"_L1;
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
GraphicsView(QWidget* parent = nullptr)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
#ifdef Q_OS_APPLE
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user