Qt 4.8
Public Functions | Private Functions | Friends | List of all members
QtopiaPrintEngine Class Reference

#include <qprintengine_qws_p.h>

Inheritance diagram for QtopiaPrintEngine:
QPaintEngine QPrintEngine

Public Functions

bool abort ()
 Instructs the print engine to abort the printing process. More...
 
bool begin (QPaintDevice *dev)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. More...
 
void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r. More...
 
void drawTextItem (const QPointF &p, const QTextItem &ti)
 This function draws the text item textItem at position p. More...
 
bool end ()
 Reimplement this function to finish painting on the current paint device. More...
 
int metric (QPaintDevice::PaintDeviceMetric metricType) const
 Returns the metric for the given id. More...
 
bool newPage ()
 Instructs the print engine to start a new page. More...
 
QRect pageRect () const
 
QPaintEnginepaintEngine () const
 
QRect paperRect () const
 
QPrinter::PrinterState printerState () const
 Returns the current state of the printer being used by the print engine. More...
 
QVariant property (PrintEnginePropertyKey key) const
 Returns the print engine's property specified by key. More...
 
 QtopiaPrintEngine (QPrinter::PrinterMode mode)
 
void setProperty (PrintEnginePropertyKey key, const QVariant &value)
 Sets the print engine's property specified by key to the given value. More...
 
QPaintEngine::Type type () const
 Reimplement this function to return the paint engine Type. More...
 
void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine. More...
 
- Public Functions inherited from QPaintEngine
void clearDirty (DirtyFlags df)
 
virtual QPoint coordinateOffset () const
 Returns the offset from the painters origo to the engines origo. More...
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect. More...
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
virtual void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap. More...
 
virtual void drawLines (const QLine *lines, int lineCount)
 The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function. More...
 
virtual void drawLines (const QLineF *lines, int lineCount)
 The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine. More...
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
virtual void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawRects (const QRect *rects, int rectCount)
 The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function. More...
 
virtual void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects. More...
 
virtual void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s)
 Reimplement this function to draw the pixmap in the given rect, starting at the given p. More...
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
virtual HDC getDC () const
 Empty default implementation. More...
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false. More...
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false. More...
 
bool isExtended () const
 Returns true if the paint engine is a QPaintEngineEx derivative. More...
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns 0. More...
 
QPainterpainter () const
 Returns the paint engine's painter. More...
 
 QPaintEngine (PaintEngineFeatures features=0)
 Creates a paint engine with the featureset specified by caps. More...
 
virtual void releaseDC (HDC hdc) const
 Empty default implementation. More...
 
void setActive (bool newState)
 Sets the active state of the paint engine to state. More...
 
void setDirty (DirtyFlags df)
 
void setPaintDevice (QPaintDevice *device)
 
void setSystemClip (const QRegion &baseClip)
 Sets the system clip for this engine. More...
 
void setSystemRect (const QRect &rect)
 Sets the target rect for drawing within the backing store. More...
 
void syncState ()
 Updates all dirty states in this engine. More...
 
QRegion systemClip () const
 Returns the system clip. More...
 
QRect systemRect () const
 Retrieves the rect for drawing within the backing store. More...
 
bool testDirty (DirtyFlags df)
 
virtual ~QPaintEngine ()
 Destroys the paint engine. More...
 
- Public Functions inherited from QPrintEngine
virtual HDC getPrinterDC () const
 
virtual void releasePrinterDC (HDC) const
 
virtual ~QPrintEngine ()
 Destroys the print engine. More...
 

Private Functions

void clearPage ()
 
void flushPage ()
 

Friends

class QPageSetupDialog
 
class QPrintDialog
 

Additional Inherited Members

- Public Types inherited from QPaintEngine
enum  DirtyFlag {
  DirtyPen = 0x0001, DirtyBrush = 0x0002, DirtyBrushOrigin = 0x0004, DirtyFont = 0x0008,
  DirtyBackground = 0x0010, DirtyBackgroundMode = 0x0020, DirtyTransform = 0x0040, DirtyClipRegion = 0x0080,
  DirtyClipPath = 0x0100, DirtyHints = 0x0200, DirtyCompositionMode = 0x0400, DirtyClipEnabled = 0x0800,
  DirtyOpacity = 0x1000, AllDirty = 0xffff
}
 QPaintEngine::updateState(). More...
 
enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001, PatternTransform = 0x00000002, PixmapTransform = 0x00000004, PatternBrush = 0x00000008,
  LinearGradientFill = 0x00000010, RadialGradientFill = 0x00000020, ConicalGradientFill = 0x00000040, AlphaBlend = 0x00000080,
  PorterDuff = 0x00000100, PainterPaths = 0x00000200, Antialiasing = 0x00000400, BrushStroke = 0x00000800,
  ConstantOpacity = 0x00001000, MaskedBrush = 0x00002000, PerspectiveTransform = 0x00004000, BlendModes = 0x00008000,
  ObjectBoundingModeGradients = 0x00010000, RasterOpModes = 0x00020000, PaintOutsidePaintEvent = 0x20000000, AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
 
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  Pdf, OpenVG, OpenGL2, PaintBuffer,
  Blitter, User = 50, MaxUser = 100
}
 
- Public Types inherited from 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_SuppressSystemPrintStatus, PPK_Duplex, PPK_PaperSources, PPK_CustomPaperSize,
  PPK_PageMargins, PPK_CopyCount, PPK_SupportsMultipleCopies, PPK_PaperSize = PPK_PageSize,
  PPK_CustomBase = 0xff00
}
 This enum is used to communicate properties between the print engine and QPrinter. More...
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

Definition at line 71 of file qprintengine_qws_p.h.

Constructors and Destructors

◆ QtopiaPrintEngine()

QtopiaPrintEngine::QtopiaPrintEngine ( QPrinter::PrinterMode  mode)

Definition at line 59 of file qprintengine_qws.cpp.

60  : QPaintEngine(*(new QtopiaPrintEnginePrivate( mode )))
61 {
62  d_func()->initialize();
63 }
QPaintEngine(PaintEngineFeatures features=0)
Creates a paint engine with the featureset specified by caps.
friend class QtopiaPrintEnginePrivate
Definition: qpaintengine.h:271

Functions

◆ abort()

bool QtopiaPrintEngine::abort ( )
virtual

Instructs the print engine to abort the printing process.

Returns true if successful; otherwise returns false.

Implements QPrintEngine.

Definition at line 200 of file qprintengine_qws.cpp.

Referenced by type().

201 {
202  return false;
203 }

◆ begin()

bool QtopiaPrintEngine::begin ( QPaintDevice pdev)
virtual

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.

Return true if the initialization was successful; otherwise return false.

See also
end() isActive()

Implements QPaintEngine.

Definition at line 65 of file qprintengine_qws.cpp.

66 {
68  Q_ASSERT_X(d->printerState == QPrinter::Idle, "QtopiaPrintEngine", "printer already active");
69 
70  // Create a new off-screen monochrome image to handle the drawing process.
71  QSize size = paperRect().size();
72  if ( d->pageImage )
73  delete d->pageImage;
74  d->pageImage = new QImage( size, QImage::Format_RGB32 );
75  if ( !(d->pageImage) )
76  return false;
77 
78  // Recreate the paint engine on the new image.
79  delete d->_paintEngine;
80  d->_paintEngine = 0;
81  d->paintEngine()->state = state;
82 
83  // Begin the paint process on the image.
84  if (!d->paintEngine()->begin(d->pageImage))
85  return false;
86 
87  // Clear the first page to all-white.
88  clearPage();
89 
90  // Clear the print buffer and output the image header.
91  d->buffer.clear();
92  d->writeG3FaxHeader();
93 
94  // The print engine is currently active.
95  d->printerState = QPrinter::Active;
96  return true;
97 }
QRect paperRect() const
double d
Definition: qnumeric_p.h:62
QPaintEngineState * state
Definition: qpaintengine.h:239
#define Q_D(Class)
Definition: qglobal.h:2482
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ clearPage()

void QtopiaPrintEngine::clearPage ( )
private

Definition at line 368 of file qprintengine_qws.cpp.

Referenced by begin(), and newPage().

369 {
370  d_func()->pageImage->fill(QColor(255, 255, 255).rgb());
371 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130

◆ drawPixmap()

void QtopiaPrintEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
)
virtual

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implements QPaintEngine.

Definition at line 150 of file qprintengine_qws.cpp.

151 {
153  Q_ASSERT(d->printerState == QPrinter::Active);
154  d->paintEngine()->drawPixmap(r, pm, sr);
155 }
double d
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482

◆ drawTextItem()

void QtopiaPrintEngine::drawTextItem ( const QPointF p,
const QTextItem textItem 
)
virtual

This function draws the text item textItem at position p.

The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Reimplemented from QPaintEngine.

Definition at line 157 of file qprintengine_qws.cpp.

158 {
160  Q_ASSERT(d->printerState == QPrinter::Active);
161  d->paintEngine()->drawTextItem(p, ti);
162 }
double d
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482

◆ end()

bool QtopiaPrintEngine::end ( )
virtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin() isActive()

Implements QPaintEngine.

Definition at line 99 of file qprintengine_qws.cpp.

100 {
102 
103  d->paintEngine()->end();
104 
105  // Flush the last page.
106  flushPage();
107 
108  // Output the fax data to a file (TODO: send to the print queuing daemon).
109  QString filename;
110  if ( !d->outputFileName.isEmpty() )
111  filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/Documents/") + d->outputFileName;
112  else
113  filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/tmp/qwsfax.tiff");
114 
116  QFile file( filename );
117  if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) {
118  qDebug( "Failed to open %s for printer output",
119  filename.toLatin1().constData() );
120  } else {
121  file.write( d->buffer.data() );
122  file.close();
123  }
124 
125  // Free up the memory for the image buffer.
126  d->buffer.clear();
127 
128  // Finalize the print job.
129  d->printerState = QPrinter::Idle;
130 
131  // call qcop service
133  for ( int x = 0; x <= QPrintEngine::PPK_Duplex; x++ )
135  QVariant variant(map);
136 
138  QDataStream out(&data, QIODevice::WriteOnly);
139  out << variant;
140  QCopChannel::send(QLatin1String("QPE/Service/Print"), QLatin1String("print(QVariant)"), data);
141 
142  return true;
143 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
Definition: qstring.cpp:4245
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static bool send(const QString &channel, const QString &msg)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
QFuture< void > map(Sequence &sequence, MapFunction function)
static const char * data(const QByteArray &arr)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
const char * variant
QVariant property(PrintEnginePropertyKey key) const
Returns the print engine&#39;s property specified by key.
void setProperty(PrintEnginePropertyKey key, const QVariant &value)
Sets the print engine&#39;s property specified by key to the given value.
PrintEnginePropertyKey
This enum is used to communicate properties between the print engine and QPrinter.
Definition: qprintengine.h:60

◆ flushPage()

void QtopiaPrintEngine::flushPage ( )
private

Definition at line 373 of file qprintengine_qws.cpp.

Referenced by end(), and newPage().

374 {
375  d_func()->writeG3FaxPage();
376 }

◆ metric()

int QtopiaPrintEngine::metric ( QPaintDevice::PaintDeviceMetric  id) const
virtual

Returns the metric for the given id.

Implements QPrintEngine.

Definition at line 210 of file qprintengine_qws.cpp.

Referenced by type().

211 {
212  int val;
213  QRect r = d_func()->fullPage ? paperRect() : pageRect();
214  switch (metricType) {
216  val = r.width();
217  break;
219  val = r.height();
220  break;
222  val = d_func()->resolution;
223  break;
225  val = d_func()->resolution;
226  break;
230  break;
232  val = qRound(r.width()*25.4/d_func()->resolution);
233  break;
235  val = qRound(r.height()*25.4/d_func()->resolution);
236  break;
238  val = 2;
239  break;
241  val = 1;
242  break;
243  default:
244  qWarning("QtopiaPrintEngine::metric: Invalid metric command");
245  return 0;
246  }
247  return val;
248 }
QRect paperRect() const
#define QT_QWS_PRINTER_DEFAULT_DPI
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QRect pageRect() const
Q_CORE_EXPORT void qWarning(const char *,...)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ newPage()

bool QtopiaPrintEngine::newPage ( )
virtual

Instructs the print engine to start a new page.

Returns true if the printer was able to create the new page; otherwise returns false.

Implements QPrintEngine.

Definition at line 192 of file qprintengine_qws.cpp.

Referenced by type().

193 {
194  flushPage();
195  clearPage();
196  ++(d_func()->pageNumber);
197  return true;
198 }

◆ pageRect()

QRect QtopiaPrintEngine::pageRect ( ) const

Definition at line 183 of file qprintengine_qws.cpp.

Referenced by metric(), property(), and type().

184 {
185  QRect r = paperRect();
186  if (d_func()->fullPage)
187  return r;
188  // would be nice to get better margins than this.
189  return QRect(d_func()->resolution/3, d_func()->resolution/3, r.width()-2*d_func()->resolution/3, r.height()-2*d_func()->resolution/3);
190 }
QRect paperRect() const
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ paintEngine()

QPaintEngine * QtopiaPrintEngine::paintEngine ( ) const

Definition at line 145 of file qprintengine_qws.cpp.

Referenced by QtopiaPrintEnginePrivate::QtopiaPrintEnginePrivate(), and type().

146 {
147  return const_cast<QtopiaPrintEnginePrivate *>(d_func())->paintEngine();
148 }
QPaintEngine * paintEngine() const

◆ paperRect()

QRect QtopiaPrintEngine::paperRect ( ) const

Definition at line 170 of file qprintengine_qws.cpp.

Referenced by begin(), metric(), pageRect(), property(), and type().

171 {
172  QSizeF s = qt_paperSizeToQSizeF(d_func()->paperSize);
173  s.rwidth() = MM(s.width());
174  s.rheight() = MM(s.height());
175  int w = qRound(s.width()*d_func()->resolution/72.);
176  int h = qRound(s.height()*d_func()->resolution/72.);
177  if (d_func()->orientation == QPrinter::Portrait)
178  return QRect(0, 0, w, h);
179  else
180  return QRect(0, 0, h, w);
181 }
QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size)
Definition: qprinter.cpp:2615
PaperSize paperSize(QPrinter::PaperSize paperSize)
Definition: qpdf.cpp:905
#define MM(n)
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
qreal & rheight()
Returns a reference to the height.
Definition: qsize.h:302
qreal & rwidth()
Returns a reference to the width.
Definition: qsize.h:299
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ printerState()

QPrinter::PrinterState QtopiaPrintEngine::printerState ( ) const
virtual

Returns the current state of the printer being used by the print engine.

Implements QPrintEngine.

Definition at line 205 of file qprintengine_qws.cpp.

Referenced by type().

206 {
207  return d_func()->printerState;
208 }

◆ property()

QVariant QtopiaPrintEngine::property ( PrintEnginePropertyKey  key) const
virtual

Returns the print engine's property specified by key.

See also
setProperty()

Implements QPrintEngine.

Definition at line 250 of file qprintengine_qws.cpp.

Referenced by end(), and type().

251 {
252  Q_D(const QtopiaPrintEngine);
253  QVariant ret;
254 
255  switch (key) {
256  case PPK_CollateCopies:
257  ret = d->collateCopies;
258  break;
259  case PPK_ColorMode:
260  ret = d->colorMode;
261  break;
262  case PPK_Creator:
263  ret = d->creator;
264  break;
265  case PPK_DocumentName:
266  ret = d->docName;
267  break;
268  case PPK_FullPage:
269  ret = d->fullPage;
270  break;
271  case PPK_CopyCount: // fallthrough
272  case PPK_NumberOfCopies:
273  ret = d->numCopies;
274  break;
276  ret = false;
277  break;
278  case PPK_Orientation:
279  ret = d->orientation;
280  break;
281  case PPK_OutputFileName:
282  ret = d->outputFileName;
283  break;
284  case PPK_PageOrder:
285  ret = d->pageOrder;
286  break;
287  case PPK_PageRect:
288  ret = pageRect();
289  break;
290  case PPK_PaperSize:
291  ret = d->paperSize;
292  break;
293  case PPK_PaperRect:
294  ret = paperRect();
295  break;
296  case PPK_PaperSource:
297  ret = d->paperSource;
298  break;
299  case PPK_PrinterName:
300  ret = d->printerName;
301  break;
302  case PPK_PrinterProgram:
303  ret = d->printProgram;
304  break;
305  case PPK_Resolution:
306  ret = d->resolution;
307  break;
310  break;
311  default:
312  break;
313  }
314  return ret;
315 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QRect paperRect() const
double d
Definition: qnumeric_p.h:62
#define QT_QWS_PRINTER_DEFAULT_DPI
#define Q_D(Class)
Definition: qglobal.h:2482
QRect pageRect() const
int key

◆ setProperty()

void QtopiaPrintEngine::setProperty ( PrintEnginePropertyKey  key,
const QVariant value 
)
virtual

Sets the print engine's property specified by key to the given value.

See also
property()

Implements QPrintEngine.

Definition at line 317 of file qprintengine_qws.cpp.

Referenced by end(), and type().

318 {
320  switch (key) {
321  case PPK_CollateCopies:
322  d->collateCopies = value.toBool();
323  break;
324  case PPK_ColorMode:
325  d->colorMode = QPrinter::ColorMode(value.toInt());
326  break;
327  case PPK_Creator:
328  d->creator = value.toString();
329  break;
330  case PPK_DocumentName:
331  d->docName = value.toString();
332  break;
333  case PPK_FullPage:
334  d->fullPage = value.toBool();
335  break;
336  case PPK_CopyCount: // fallthrough
337  case PPK_NumberOfCopies:
338  d->numCopies = value.toInt();
339  break;
340  case PPK_Orientation:
341  d->orientation = QPrinter::Orientation(value.toInt());
342  break;
343  case PPK_OutputFileName:
344  d->outputFileName = value.toString();
345  break;
346  case PPK_PageOrder:
347  d->pageOrder = QPrinter::PageOrder(value.toInt());
348  break;
349  case PPK_PaperSize:
350  d->paperSize = QPrinter::PaperSize(value.toInt());
351  break;
352  case PPK_PaperSource:
353  d->paperSource = QPrinter::PaperSource(value.toInt());
354  case PPK_PrinterName:
355  d->printerName = value.toString();
356  break;
357  case PPK_PrinterProgram:
358  d->printProgram = value.toString();
359  break;
360  case PPK_Resolution:
361  d->resolution = value.toInt();
362  break;
363  default:
364  break;
365  }
366 }
double d
Definition: qnumeric_p.h:62
Orientation
This enum type (not to be confused with Orientation) is used to specify each page&#39;s orientation...
Definition: qprinter.h:78
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
Definition: qvariant.cpp:2691
#define Q_D(Class)
Definition: qglobal.h:2482
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
PaperSize
This enum type specifies what paper size QPrinter should use.
Definition: qprinter.h:91
int key
ColorMode
This enum type is used to indicate whether QPrinter should print in color or not. ...
Definition: qprinter.h:100
PageOrder
This enum type is used by QPrinter to tell the application program how to print.
Definition: qprinter.h:97
PaperSource
This enum type specifies what paper source QPrinter is to use.
Definition: qprinter.h:103

◆ type()

QPaintEngine::Type QtopiaPrintEngine::type ( ) const
inlinevirtual

Reimplement this function to return the paint engine Type.

Implements QPaintEngine.

Definition at line 82 of file qprintengine_qws_p.h.

◆ updateState()

void QtopiaPrintEngine::updateState ( const QPaintEngineState state)
virtual

Reimplement this function to update the state of a paint engine.

When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding GetFunction{get function} to retrieve the current values for the given properties.

See also
QPaintEngineState

Implements QPaintEngine.

Definition at line 164 of file qprintengine_qws.cpp.

Referenced by type().

165 {
167  d->paintEngine()->updateState(state);
168 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Friends and Related Functions

◆ QPageSetupDialog

friend class QPageSetupDialog
friend

Definition at line 103 of file qprintengine_qws_p.h.

◆ QPrintDialog

friend class QPrintDialog
friend

Definition at line 102 of file qprintengine_qws_p.h.


The documentation for this class was generated from the following files: