Qt 4.8
qprinterinfo.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the documentation of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:FDL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Free Documentation License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Free
19 ** Documentation License version 1.3 as published by the Free Software
20 ** Foundation and appearing in the file included in the packaging of
21 ** this file. Please review the following information to ensure
22 ** the GNU Free Documentation License version 1.3 requirements
23 ** will be met: http://www.gnu.org/copyleft/fdl.html.
24 ** $QT_END_LICENSE$
25 **
26 ****************************************************************************/
27 
28 #include "qprinterinfo.h"
29 #include "qprinterinfo_p.h"
30 
31 #ifndef QT_NO_PRINTER
32 
34 
36 
37 
86  : d_ptr(&QPrinterInfoPrivate::shared_null)
87 {
88 }
89 
99  : d_ptr(new QPrinterInfoPrivate(*other.d_ptr))
100 {
101 }
102 
107  : d_ptr(&QPrinterInfoPrivate::shared_null)
108 {
109  foreach (const QPrinterInfo &printerInfo, availablePrinters()) {
110  if (printerInfo.printerName() == printer.printerName()) {
111  d_ptr.reset(new QPrinterInfoPrivate(*printerInfo.d_ptr));
112  break;
113  }
114  }
115 }
116 
121  : d_ptr(new QPrinterInfoPrivate(name))
122 {
123 }
124 
130 {
131 }
132 
142 {
143  Q_ASSERT(d_ptr);
144  d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr));
145  return *this;
146 }
147 
154 {
155  const Q_D(QPrinterInfo);
156  return d->name;
157 }
158 
166 {
167  const Q_D(QPrinterInfo);
169 }
170 
175 {
176  const Q_D(QPrinterInfo);
177  return d->isDefault;
178 }
179 
194 
195 #endif // QT_NO_PRINTER
double d
Definition: qnumeric_p.h:62
QPrinterInfo()
Constructs an empty QPrinterInfo object.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * name
The QPrinter class is a paint device that paints on a printer.
Definition: qprinter.h:66
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
bool isDefault() const
Returns whether this printer is the default printer.
The QPrinterInfo class gives access to information about existing printers.
Definition: qprinterinfo.h:58
QString printerName() const
Returns the name of the printer.
~QPrinterInfo()
Destroys the QPrinterInfo object.
QPrinterInfo & operator=(const QPrinterInfo &other)
Sets the QPrinterInfo object to be equal to other.
static QPrinterInfoPrivate shared_null
QScopedPointer< QPrinterInfoPrivate, QPrinterInfoPrivateDeleter > d_ptr
Definition: qprinterinfo.h:81
static QList< QPrinterInfo > availablePrinters()
Returns a list of available printers on the system.
bool isNull() const
Returns whether this QPrinterInfo object holds a printer definition.
QString printerName() const
Returns the printer name.
Definition: qprinter.cpp:834