56 #include <QMessageLogger>
63 :QPaintDevice(), engine(new
VObjEngine()), fileName(), owns_iodevice(1)
73 delete engine->getOutputDevice();
96 qWarning(
"VObjPaintDevice::setFileName(), cannot set file name while OBJ is being generated");
102 delete engine->getOutputDevice();
109 engine->setOutputDevice(file);
123 qWarning(
"VObjPaintDevice::setSize(), cannot set size while OBJ is being generated");
132 return engine->getOutputDevice();
140 qWarning(
"VObjPaintDevice::setOutputDevice(), cannot set output device while OBJ is being generated");
144 engine->setOutputDevice(outputDevice);
151 return engine->getResolution();
157 engine->setResolution(dpi);
165 case QPaintDevice::PdmDepth:
167 case QPaintDevice::PdmWidth:
168 return engine->getSize().width();
169 case QPaintDevice::PdmHeight:
170 return engine->getSize().height();
171 case QPaintDevice::PdmHeightMM:
172 return qRound(
engine->getSize().height() * 25.4 /
engine->getResolution());
173 case QPaintDevice::PdmWidthMM:
174 return qRound(
engine->getSize().width() * 25.4 /
engine->getResolution());
175 case QPaintDevice::PdmNumColors:
176 return static_cast<int>(0xffffffff);
177 case QPaintDevice::PdmDpiX:
178 case QPaintDevice::PdmDpiY:
179 case QPaintDevice::PdmPhysicalDpiX:
180 case QPaintDevice::PdmPhysicalDpiY:
181 return engine->getResolution();
182 case QPaintDevice::PdmDevicePixelRatio:
183 case QPaintDevice::PdmDevicePixelRatioScaled:
186 qWarning(
"VObjPaintDevice::metric(), unhandled metric %d\n",
metric);
virtual ~VObjPaintDevice() Q_DECL_OVERRIDE
virtual QPaintEngine * paintEngine() const Q_DECL_OVERRIDE
QIODevice * getOutputDevice()
void setResolution(int dpi)
QString getFileName() const
void setSize(const QSize &size)
QSharedPointer< VObjEngine > engine
void setFileName(const QString &value)
virtual int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE
void setOutputDevice(QIODevice *outputDevice)
int getResolution() const