Allow access to ppd file and ppdMarkOption via QPpdPrintDevice::property/setProperty
Change-Id: I47b49b52121950fa8e3ea7a056974d9f3033490f Reviewed-by: Liang Qi <liang.qi@qt.io>bb10
parent
70f6a35c8f
commit
e79efe94e3
|
|
@ -42,6 +42,8 @@
|
|||
#include <QtCore/QMimeDatabase>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include "private/qcups_p.h" // Only needed for PDPK_*
|
||||
|
||||
#ifndef QT_LINUXBASE // LSB merges everything into cups.h
|
||||
#include <cups/language.h>
|
||||
#endif
|
||||
|
|
@ -421,6 +423,25 @@ QPrint::ColorMode QPpdPrintDevice::defaultColorMode() const
|
|||
return QPrint::GrayScale;
|
||||
}
|
||||
|
||||
QVariant QPpdPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const
|
||||
{
|
||||
if (key == PDPK_PpdFile)
|
||||
return QVariant::fromValue<ppd_file_t *>(m_ppd);
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value)
|
||||
{
|
||||
if (key == PDPK_PpdOption) {
|
||||
const QStringList values = value.toStringList();
|
||||
if (values.count() == 2)
|
||||
return ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1()) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
void QPpdPrintDevice::loadMimeTypes() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ public:
|
|||
|
||||
QPrint::ColorMode defaultColorMode() const override;
|
||||
|
||||
QVariant property(QPrintDevice::PrintDevicePropertyKey key) const override;
|
||||
bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) override;
|
||||
|
||||
protected:
|
||||
void loadPageSizes() const override;
|
||||
void loadResolutions() const override;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ QT_BEGIN_NAMESPACE
|
|||
// removed from the dialogs.
|
||||
#define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00)
|
||||
|
||||
#define PDPK_PpdFile QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase)
|
||||
#define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1)
|
||||
|
||||
class Q_PRINTSUPPORT_EXPORT QCUPSSupport
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
#if (defined Q_OS_MACOS) || (defined Q_OS_UNIX && QT_CONFIG(cups))
|
||||
#include <cups/ppd.h> // Use for type defs only, don't want to actually link in main module
|
||||
Q_DECLARE_METATYPE(ppd_file_t *)
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue