This commit is contained in:
rattatwinko
2025-05-25 20:42:58 +02:00
commit 8e9b2568b2
4902 changed files with 1152638 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# Automatically generated configuration for PyQt5.QtPrintSupport.
sip-version = "6.8.6"
sip-abi-version = "12.15"
module-tags = ["Qt_5_15_14", "WS_X11"]
module-disabled-features = []

View File

@@ -0,0 +1,58 @@
// QtPrintSupportmod.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%Module(name=PyQt5.QtPrintSupport, keyword_arguments="Optional", use_limited_api=True)
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
%Import QtWidgets/QtWidgetsmod.sip
%Copying
Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
This file is part of PyQt5.
This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and appearing in
the file LICENSE included in the packaging of this file. Please review the
following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you do not wish to use this file under the terms of the GPL version 3.0
then you may purchase a commercial license. For more information contact
info@riverbankcomputing.com.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%End
%DefaultSupertype sip.simplewrapper
%Include qabstractprintdialog.sip
%Include qpagesetupdialog.sip
%Include qprintdialog.sip
%Include qprintengine.sip
%Include qprinter.sip
%Include qprinterinfo.sip
%Include qprintpreviewdialog.sip
%Include qprintpreviewwidget.sip
%Include qpyprintsupport_qlist.sip

View File

@@ -0,0 +1,174 @@
// qabstractprintdialog.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Printer)
class QAbstractPrintDialog : public QDialog
{
%TypeHeaderCode
#include <qabstractprintdialog.h>
%End
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipTypeDef **type;
int yes, no;
} graph[] = {
#if defined(SIP_FEATURE_PyQt_PrintDialog)
{sipName_QPageSetupDialog, &sipType_QPageSetupDialog, -1, 1},
#else
{0, 0, -1, 1},
#endif
#if defined(SIP_FEATURE_PyQt_PrintPreviewWidget)
{sipName_QPrintPreviewWidget, &sipType_QPrintPreviewWidget, -1, 2},
#else
{0, 0, -1, 2},
#endif
#if defined(SIP_FEATURE_PyQt_PrintPreviewDialog)
{sipName_QPrintPreviewDialog, &sipType_QPrintPreviewDialog, -1, 3},
#else
{0, 0, -1, 3},
#endif
#if defined(SIP_FEATURE_PyQt_Printer)
{sipName_QAbstractPrintDialog, &sipType_QAbstractPrintDialog, 4, -1},
#else
{0, 0, 4, -1},
#endif
#if defined(SIP_FEATURE_PyQt_PrintDialog)
{sipName_QPrintDialog, &sipType_QPrintDialog, -1, -1},
#else
{0, 0, -1, -1},
#endif
};
int i = 0;
sipType = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipType = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
public:
enum PrintRange
{
AllPages,
Selection,
PageRange,
CurrentPage,
};
%If (Py_v3)
enum PrintDialogOption
{
None /PyName=None_/,
PrintToFile,
PrintSelection,
PrintPageRange,
PrintCollateCopies,
PrintShowPageSize,
PrintCurrentPage,
};
%End
%If (!Py_v3)
// Backward compatible PrintDialogOption for Python v2.
// Note that we have to duplicate the whole enum because MetaSIP doesn't
// support handwritten code in enum definitions.
enum PrintDialogOption {
None,
None /PyName=None_/,
PrintToFile,
PrintSelection,
PrintPageRange,
PrintCollateCopies,
PrintShowPageSize,
PrintCurrentPage
};
%End
typedef QFlags<QAbstractPrintDialog::PrintDialogOption> PrintDialogOptions;
%If (PyQt_PrintDialog)
QAbstractPrintDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0);
virtual ~QAbstractPrintDialog();
virtual int exec() = 0 /PyName=exec_,ReleaseGIL/;
%If (Py_v3)
virtual int exec() = 0 /ReleaseGIL/;
%End
void setPrintRange(QAbstractPrintDialog::PrintRange range);
QAbstractPrintDialog::PrintRange printRange() const;
void setMinMax(int min, int max);
int minPage() const;
int maxPage() const;
void setFromTo(int fromPage, int toPage);
int fromPage() const;
int toPage() const;
QPrinter *printer() const;
void setOptionTabs(const QList<QWidget *> &tabs);
%If (Qt_5_6_0 -)
void setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions options);
%End
%If (Qt_5_6_0 -)
QAbstractPrintDialog::PrintDialogOptions enabledOptions() const;
%End
private:
QAbstractPrintDialog(const QAbstractPrintDialog &);
public:
%End // PyQt_PrintDialog
};
%End
%If (PyQt_Printer)
QFlags<QAbstractPrintDialog::PrintDialogOption> operator|(QAbstractPrintDialog::PrintDialogOption f1, QFlags<QAbstractPrintDialog::PrintDialogOption> f2);
%End
%ModuleHeaderCode
// Imports from QtCore.
typedef sipErrorState (*pyqt5_qtprintsupport_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &);
extern pyqt5_qtprintsupport_get_connection_parts_t pyqt5_qtprintsupport_get_connection_parts;
%End
%ModuleCode
// Imports from QtCore.
pyqt5_qtprintsupport_get_connection_parts_t pyqt5_qtprintsupport_get_connection_parts;
%End
%PostInitialisationCode
// Imports from QtCore.
pyqt5_qtprintsupport_get_connection_parts = (pyqt5_qtprintsupport_get_connection_parts_t)sipImportSymbol("pyqt5_get_connection_parts");
Q_ASSERT(pyqt5_qtprintsupport_get_connection_parts);
%End

View File

@@ -0,0 +1,86 @@
// qpagesetupdialog.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_PrintDialog)
class QPageSetupDialog : public QDialog
{
%TypeHeaderCode
#include <qpagesetupdialog.h>
%End
public:
QPageSetupDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0);
explicit QPageSetupDialog(QWidget *parent /TransferThis/ = 0);
virtual ~QPageSetupDialog();
virtual void setVisible(bool visible);
virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
%MethodCode
// Transfer ownership back to Python (a modal dialog will probably have the
// main window as it's parent). This means the Qt dialog will be deleted when
// the Python wrapper is garbage collected. Although this is a little
// inconsistent, it saves having to code it explicitly to avoid the memory
// leak.
sipTransferBack(sipSelf);
Py_BEGIN_ALLOW_THREADS
sipRes = sipSelfWasArg ? sipCpp->QPageSetupDialog::exec()
: sipCpp->exec();
Py_END_ALLOW_THREADS
%End
virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
%MethodCode
// Transfer ownership back to Python (a modal dialog will probably have the
// main window as it's parent). This means the Qt dialog will be deleted when
// the Python wrapper is garbage collected. Although this is a little
// inconsistent, it saves having to code it explicitly to avoid the memory
// leak.
sipTransferBack(sipSelf);
Py_BEGIN_ALLOW_THREADS
sipRes = sipSelfWasArg ? sipCpp->QPageSetupDialog::exec()
: sipCpp->exec();
Py_END_ALLOW_THREADS
%End
virtual void open();
void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
%MethodCode
QObject *receiver;
QByteArray slot_signature;
if ((sipError = pyqt5_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
{
sipCpp->open(receiver, slot_signature.constData());
}
else if (sipError == sipErrorContinue)
{
sipError = sipBadCallableArg(0, a0);
}
%End
virtual void done(int result);
QPrinter *printer();
};
%End

View File

@@ -0,0 +1,97 @@
// qprintdialog.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_PrintDialog)
class QPrintDialog : public QAbstractPrintDialog
{
%TypeHeaderCode
#include <qprintdialog.h>
%End
public:
QPrintDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0);
explicit QPrintDialog(QWidget *parent /TransferThis/ = 0);
virtual ~QPrintDialog();
virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,PyName=exec_,ReleaseGIL/;
%MethodCode
// Transfer ownership back to Python (a modal dialog will probably have the
// main window as it's parent). This means the Qt dialog will be deleted when
// the Python wrapper is garbage collected. Although this is a little
// inconsistent, it saves having to code it explicitly to avoid the memory
// leak.
sipTransferBack(sipSelf);
Py_BEGIN_ALLOW_THREADS
sipRes = sipSelfWasArg ? sipCpp->QPrintDialog::exec()
: sipCpp->exec();
Py_END_ALLOW_THREADS
%End
%If (Py_v3)
virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
%MethodCode
// Transfer ownership back to Python (a modal dialog will probably have the
// main window as it's parent). This means the Qt dialog will be deleted when
// the Python wrapper is garbage collected. Although this is a little
// inconsistent, it saves having to code it explicitly to avoid the memory
// leak.
sipTransferBack(sipSelf);
Py_BEGIN_ALLOW_THREADS
sipRes = sipSelfWasArg ? sipCpp->QPrintDialog::exec()
: sipCpp->exec();
Py_END_ALLOW_THREADS
%End
%End
%If (WS_X11)
virtual void accept();
%End
virtual void done(int result);
void setOption(QAbstractPrintDialog::PrintDialogOption option, bool on = true);
bool testOption(QAbstractPrintDialog::PrintDialogOption option) const;
void setOptions(QAbstractPrintDialog::PrintDialogOptions options);
QAbstractPrintDialog::PrintDialogOptions options() const;
virtual void setVisible(bool visible);
virtual void open();
void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
%MethodCode
QObject *receiver;
QByteArray slot_signature;
if ((sipError = pyqt5_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
{
sipCpp->open(receiver, slot_signature.constData());
}
else if (sipError == sipErrorContinue)
{
sipError = sipBadCallableArg(0, a0);
}
%End
signals:
void accepted();
void accepted(QPrinter *printer);
};
%End

View File

@@ -0,0 +1,86 @@
// qprintengine.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Printer)
class QPrintEngine
{
%TypeHeaderCode
#include <qprintengine.h>
%End
public:
virtual ~QPrintEngine();
enum PrintEnginePropertyKey
{
PPK_CollateCopies,
PPK_ColorMode,
PPK_Creator,
PPK_DocumentName,
PPK_FullPage,
PPK_NumberOfCopies,
PPK_Orientation,
PPK_OutputFileName,
PPK_PageOrder,
PPK_PageRect,
PPK_PageSize,
PPK_PaperRect,
PPK_PaperSource,
PPK_PrinterName,
PPK_PrinterProgram,
PPK_Resolution,
PPK_SelectionOption,
PPK_SupportedResolutions,
PPK_WindowsPageSize,
PPK_FontEmbedding,
PPK_Duplex,
PPK_PaperSources,
PPK_CustomPaperSize,
PPK_PageMargins,
PPK_PaperSize,
PPK_CopyCount,
PPK_SupportsMultipleCopies,
%If (Qt_5_1_0 -)
PPK_PaperName,
%End
%If (Qt_5_3_0 -)
PPK_QPageSize,
%End
%If (Qt_5_3_0 -)
PPK_QPageMargins,
%End
%If (Qt_5_3_0 -)
PPK_QPageLayout,
%End
PPK_CustomBase,
};
virtual void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) = 0;
virtual QVariant property(QPrintEngine::PrintEnginePropertyKey key) const = 0;
virtual bool newPage() = 0;
virtual bool abort() = 0;
virtual int metric(QPaintDevice::PaintDeviceMetric) const = 0;
virtual QPrinter::PrinterState printerState() const = 0;
};
%End

View File

@@ -0,0 +1,216 @@
// qprinter.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Printer)
class QPrinter : public QPagedPaintDevice
{
%TypeHeaderCode
#include <qprinter.h>
%End
public:
enum PrinterMode
{
ScreenResolution,
PrinterResolution,
HighResolution,
};
explicit QPrinter(QPrinter::PrinterMode mode = QPrinter::ScreenResolution);
QPrinter(const QPrinterInfo &printer, QPrinter::PrinterMode mode = QPrinter::ScreenResolution);
virtual ~QPrinter();
enum Orientation
{
Portrait,
Landscape,
};
typedef QPagedPaintDevice::PageSize PaperSize;
enum PageOrder
{
FirstPageFirst,
LastPageFirst,
};
enum ColorMode
{
GrayScale,
Color,
};
enum PaperSource
{
OnlyOne,
Lower,
Middle,
Manual,
Envelope,
EnvelopeManual,
Auto,
Tractor,
SmallFormat,
LargeFormat,
LargeCapacity,
Cassette,
FormSource,
MaxPageSource,
%If (Qt_5_3_0 -)
Upper,
%End
%If (Qt_5_3_0 -)
CustomSource,
%End
%If (Qt_5_3_0 -)
LastPaperSource,
%End
};
enum PrinterState
{
Idle,
Active,
Aborted,
Error,
};
enum OutputFormat
{
NativeFormat,
PdfFormat,
};
enum PrintRange
{
AllPages,
Selection,
PageRange,
CurrentPage,
};
enum Unit
{
Millimeter,
Point,
Inch,
Pica,
Didot,
Cicero,
DevicePixel,
};
enum DuplexMode
{
DuplexNone,
DuplexAuto,
DuplexLongSide,
DuplexShortSide,
};
void setOutputFormat(QPrinter::OutputFormat format);
QPrinter::OutputFormat outputFormat() const;
void setPrinterName(const QString &);
QString printerName() const;
bool isValid() const;
void setOutputFileName(const QString &);
QString outputFileName() const;
void setPrintProgram(const QString &);
QString printProgram() const;
void setDocName(const QString &);
QString docName() const;
void setCreator(const QString &);
QString creator() const;
void setOrientation(QPrinter::Orientation);
QPrinter::Orientation orientation() const;
virtual void setPageSizeMM(const QSizeF &size);
void setPaperSize(QPrinter::PaperSize);
QPrinter::PaperSize paperSize() const;
void setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit);
QSizeF paperSize(QPrinter::Unit unit) const;
void setPageOrder(QPrinter::PageOrder);
QPrinter::PageOrder pageOrder() const;
void setResolution(int);
int resolution() const;
void setColorMode(QPrinter::ColorMode);
QPrinter::ColorMode colorMode() const;
void setCollateCopies(bool collate);
bool collateCopies() const;
void setFullPage(bool);
bool fullPage() const;
void setCopyCount(int);
int copyCount() const;
bool supportsMultipleCopies() const;
void setPaperSource(QPrinter::PaperSource);
QPrinter::PaperSource paperSource() const;
void setDuplex(QPrinter::DuplexMode duplex);
QPrinter::DuplexMode duplex() const;
QList<int> supportedResolutions() const;
void setFontEmbeddingEnabled(bool enable);
bool fontEmbeddingEnabled() const;
void setDoubleSidedPrinting(bool enable);
bool doubleSidedPrinting() const;
QRect paperRect() const;
QRect pageRect() const;
QRectF paperRect(QPrinter::Unit) const;
QRectF pageRect(QPrinter::Unit) const;
%If (WS_X11 || WS_MACX)
QString printerSelectionOption() const;
%End
%If (WS_X11 || WS_MACX)
void setPrinterSelectionOption(const QString &);
%End
virtual bool newPage();
bool abort();
QPrinter::PrinterState printerState() const;
virtual QPaintEngine *paintEngine() const;
QPrintEngine *printEngine() const;
void setFromTo(int fromPage, int toPage);
int fromPage() const;
int toPage() const;
void setPrintRange(QPrinter::PrintRange range);
QPrinter::PrintRange printRange() const;
virtual void setMargins(const QPagedPaintDevice::Margins &m);
void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit);
void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const;
protected:
virtual int metric(QPaintDevice::PaintDeviceMetric) const;
void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
public:
%If (Qt_5_1_0 -)
void setPaperName(const QString &paperName);
%End
%If (Qt_5_1_0 -)
QString paperName() const;
%End
%If (Qt_5_10_0 -)
void setPdfVersion(QPagedPaintDevice::PdfVersion version);
%End
%If (Qt_5_10_0 -)
QPagedPaintDevice::PdfVersion pdfVersion() const;
%End
};
%End

View File

@@ -0,0 +1,93 @@
// qprinterinfo.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Printer)
class QPrinterInfo
{
%TypeHeaderCode
#include <qprinterinfo.h>
%End
public:
QPrinterInfo();
QPrinterInfo(const QPrinterInfo &src);
explicit QPrinterInfo(const QPrinter &printer);
~QPrinterInfo();
QString printerName() const;
bool isNull() const;
bool isDefault() const;
QList<QPagedPaintDevice::PageSize> supportedPaperSizes() const;
%If (Qt_5_1_0 -)
QList<QPair<QString, QSizeF>> supportedSizesWithNames() const;
%End
static QList<QPrinterInfo> availablePrinters();
static QPrinterInfo defaultPrinter();
QString description() const;
QString location() const;
QString makeAndModel() const;
static QPrinterInfo printerInfo(const QString &printerName);
%If (Qt_5_3_0 -)
bool isRemote() const;
%End
%If (Qt_5_3_0 -)
QPrinter::PrinterState state() const;
%End
%If (Qt_5_3_0 -)
QList<QPageSize> supportedPageSizes() const;
%End
%If (Qt_5_3_0 -)
QPageSize defaultPageSize() const;
%End
%If (Qt_5_3_0 -)
bool supportsCustomPageSizes() const;
%End
%If (Qt_5_3_0 -)
QPageSize minimumPhysicalPageSize() const;
%End
%If (Qt_5_3_0 -)
QPageSize maximumPhysicalPageSize() const;
%End
%If (Qt_5_3_0 -)
QList<int> supportedResolutions() const;
%End
%If (Qt_5_3_0 -)
static QStringList availablePrinterNames();
%End
%If (Qt_5_3_0 -)
static QString defaultPrinterName();
%End
%If (Qt_5_4_0 -)
QPrinter::DuplexMode defaultDuplexMode() const;
%End
%If (Qt_5_4_0 -)
QList<QPrinter::DuplexMode> supportedDuplexModes() const;
%End
%If (Qt_5_13_0 -)
QPrinter::ColorMode defaultColorMode() const;
%End
%If (Qt_5_13_0 -)
QList<QPrinter::ColorMode> supportedColorModes() const;
%End
};
%End

View File

@@ -0,0 +1,59 @@
// qprintpreviewdialog.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_PrintPreviewDialog)
class QPrintPreviewDialog : public QDialog
{
%TypeHeaderCode
#include <qprintpreviewdialog.h>
%End
public:
QPrintPreviewDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags());
QPrintPreviewDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags());
virtual ~QPrintPreviewDialog();
virtual void setVisible(bool visible);
virtual void open();
void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
%MethodCode
QObject *receiver;
QByteArray slot_signature;
if ((sipError = pyqt5_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
{
sipCpp->open(receiver, slot_signature.constData());
}
else if (sipError == sipErrorContinue)
{
sipError = sipBadCallableArg(0, a0);
}
%End
QPrinter *printer();
virtual void done(int result);
signals:
void paintRequested(QPrinter *printer);
};
%End

View File

@@ -0,0 +1,85 @@
// qprintpreviewwidget.sip generated by MetaSIP
//
// This file is part of the QtPrintSupport Python extension module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_PrintPreviewWidget)
class QPrintPreviewWidget : public QWidget
{
%TypeHeaderCode
#include <qprintpreviewwidget.h>
%End
public:
enum ViewMode
{
SinglePageView,
FacingPagesView,
AllPagesView,
};
enum ZoomMode
{
CustomZoom,
FitToWidth,
FitInView,
};
QPrintPreviewWidget(QPrinter *printer, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags());
QPrintPreviewWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags());
virtual ~QPrintPreviewWidget();
qreal zoomFactor() const;
QPrinter::Orientation orientation() const;
QPrintPreviewWidget::ViewMode viewMode() const;
QPrintPreviewWidget::ZoomMode zoomMode() const;
int currentPage() const;
public slots:
virtual void setVisible(bool visible);
void print() /PyName=print_/;
%If (Py_v3)
void print();
%End
void zoomIn(qreal factor = 1.1);
void zoomOut(qreal factor = 1.1);
void setZoomFactor(qreal zoomFactor);
void setOrientation(QPrinter::Orientation orientation);
void setViewMode(QPrintPreviewWidget::ViewMode viewMode);
void setZoomMode(QPrintPreviewWidget::ZoomMode zoomMode);
void setCurrentPage(int pageNumber);
void fitToWidth();
void fitInView();
void setLandscapeOrientation();
void setPortraitOrientation();
void setSinglePageViewMode();
void setFacingPagesViewMode();
void setAllPagesViewMode();
void updatePreview();
signals:
void paintRequested(QPrinter *printer);
void previewChanged();
public:
int pageCount() const;
};
%End

View File

@@ -0,0 +1,354 @@
// This is the SIP interface definition for the QList based mapped types
// specific to the QtPrintSupport module.
//
// Copyright (c) 2024 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt5.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Printer)
%MappedType QList<QPagedPaintDevice::PageSize>
/TypeHintIn="Iterable[QPagedPaintDevice.PageSize]",
TypeHintOut="List[QPagedPaintDevice.PageSize]", TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qprinterinfo.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
PyObject *eobj = sipConvertFromEnum(sipCpp->at(i),
sipType_QPagedPaintDevice_PageSize);
if (!eobj)
{
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, eobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter
#if PY_MAJOR_VERSION < 3
&& !PyString_Check(sipPy)
#endif
&& !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QList<QPagedPaintDevice::PageSize> *ql = new QList<QPagedPaintDevice::PageSize>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int v = sipConvertToEnum(itm, sipType_QPagedPaintDevice_PageSize);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'QPagedPaintDevice.PageSize' is expected",
i, sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
ql->append(static_cast<QPagedPaintDevice::PageSize>(v));
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
%End
%If (PyQt_Printer)
%If (Qt_5_4_0 -)
%MappedType QList<QPrinter::DuplexMode>
/TypeHintIn="Iterable[QPrinter.DuplexMode]",
TypeHintOut="List[QPrinter.DuplexMode]", TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qprinter.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
PyObject *eobj = sipConvertFromEnum(sipCpp->at(i),
sipType_QPrinter_DuplexMode);
if (!eobj)
{
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, eobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter
#if PY_MAJOR_VERSION < 3
&& !PyString_Check(sipPy)
#endif
&& !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QList<QPrinter::DuplexMode> *ql = new QList<QPrinter::DuplexMode>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int v = sipConvertToEnum(itm, sipType_QPrinter_DuplexMode);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'QPrinter.DuplexMode' is expected",
i, sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
ql->append(static_cast<QPrinter::DuplexMode>(v));
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
%End
%End
%If (PyQt_Printer)
%If (Qt_5_13_0 -)
%MappedType QList<QPrinter::ColorMode>
/TypeHintIn="Iterable[QPrinter.ColorMode]",
TypeHintOut="List[QPrinter.ColorMode]", TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qprinter.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
PyObject *eobj = sipConvertFromEnum(sipCpp->at(i),
sipType_QPrinter_ColorMode);
if (!eobj)
{
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, eobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter
#if PY_MAJOR_VERSION < 3
&& !PyString_Check(sipPy)
#endif
&& !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QList<QPrinter::ColorMode> *ql = new QList<QPrinter::ColorMode>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int v = sipConvertToEnum(itm, sipType_QPrinter_ColorMode);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'QPrinter.ColorMode' is expected",
i, sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
ql->append(static_cast<QPrinter::ColorMode>(v));
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
%End
%End