Introduce QPrintDevice::property/setProperty

So we can access QPlatformPrintDevice internals if needed

Change-Id: Ib37c5717713f37262ef12d7b61793d80f05baf4a
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
Albert Astals Cid 2017-12-04 13:23:49 +01:00
parent e5312f9ca5
commit 70f6a35c8f
4 changed files with 38 additions and 0 deletions

View File

@ -381,6 +381,21 @@ void QPlatformPrintDevice::loadMimeTypes() const
{
}
QVariant QPlatformPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const
{
Q_UNUSED(key)
return QVariant();
}
bool QPlatformPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value)
{
Q_UNUSED(key)
Q_UNUSED(value)
return false;
}
QList<QMimeType> QPlatformPrintDevice::supportedMimeTypes() const
{
if (!m_haveMimeTypes)

View File

@ -53,11 +53,14 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#include <private/qprint_p.h>
#include <private/qprintdevice_p.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
#include <QtCore/qmimetype.h>
#include <QtGui/qpagelayout.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@ -118,6 +121,9 @@ public:
virtual QPrint::ColorMode defaultColorMode() const;
virtual QList<QPrint::ColorMode> supportedColorModes() const;
virtual QVariant property(QPrintDevice::PrintDevicePropertyKey key) const;
virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value);
#ifndef QT_NO_MIMETYPE
virtual QList<QMimeType> supportedMimeTypes() const;
#endif

View File

@ -245,6 +245,16 @@ QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const
return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
}
QVariant QPrintDevice::property(PrintDevicePropertyKey key) const
{
return isValid() ? d->property(key) : QVariant();
}
bool QPrintDevice::setProperty(PrintDevicePropertyKey key, const QVariant &value)
{
return isValid() ? d->setProperty(key, value) : false;
}
#ifndef QT_NO_MIMETYPE
QList<QMimeType> QPrintDevice::supportedMimeTypes() const
{

View File

@ -131,6 +131,13 @@ public:
QPrint::ColorMode defaultColorMode() const;
QList<QPrint::ColorMode> supportedColorModes() const;
enum PrintDevicePropertyKey {
PDPK_CustomBase = 0xff00
};
QVariant property(PrintDevicePropertyKey key) const;
bool setProperty(PrintDevicePropertyKey key, const QVariant &value);
#ifndef QT_NO_MIMETYPE
QList<QMimeType> supportedMimeTypes() const;
#endif