QtBase  v6.3.1
qimage.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
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 The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QIMAGE_H
41 #define QIMAGE_H
42 
43 #include <QtGui/qtguiglobal.h>
44 #include <QtGui/qcolor.h>
45 #include <QtGui/qrgb.h>
46 #include <QtGui/qpaintdevice.h>
47 #include <QtGui/qpixelformat.h>
48 #include <QtGui/qtransform.h>
49 #include <QtCore/qbytearray.h>
50 #include <QtCore/qbytearrayview.h>
51 #include <QtCore/qrect.h>
52 #include <QtCore/qstring.h>
53 #include <QtCore/qcontainerfwd.h>
54 
55 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
57 #endif
58 
60 
61 
62 class QColorSpace;
63 class QColorTransform;
64 class QIODevice;
65 class QTransform;
66 class QVariant;
67 
68 struct QImageData;
69 
70 typedef void (*QImageCleanupFunction)(void*);
71 
72 class Q_GUI_EXPORT QImage : public QPaintDevice
73 {
74  Q_GADGET
75 public:
76  enum InvertMode { InvertRgb, InvertRgba };
77  enum Format {
114 #ifndef Q_QDOC
115  NImageFormats
116 #endif
117  };
118  Q_ENUM(Format)
119 
120  QImage() noexcept;
121  QImage(const QSize &size, Format format);
122  QImage(int width, int height, Format format);
123  QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
124  QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
125  QImage(uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
126  QImage(const uchar *data, int width, int height, qsizetype bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
127 
128 #ifndef QT_NO_IMAGEFORMAT_XPM
129  explicit QImage(const char * const xpm[]);
130 #endif
131  explicit QImage(const QString &fileName, const char *format = nullptr);
132 
133  QImage(const QImage &);
134  QImage(QImage &&other) noexcept
135  : QPaintDevice(), d(qExchange(other.d, nullptr))
136  {}
137  ~QImage();
138 
139  QImage &operator=(const QImage &);
141  void swap(QImage &other) noexcept
142  { qt_ptr_swap(d, other.d); }
143 
144  bool isNull() const;
145 
146  int devType() const override;
147 
148  bool operator==(const QImage &) const;
149  bool operator!=(const QImage &) const;
150  operator QVariant() const;
151  void detach();
152  bool isDetached() const;
153 
154  [[nodiscard]] QImage copy(const QRect &rect = QRect()) const;
155  [[nodiscard]] QImage copy(int x, int y, int w, int h) const
156  { return copy(QRect(x, y, w, h)); }
157 
158  Format format() const;
159 
160  [[nodiscard]] QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
161  { return convertToFormat_helper(f, flags); }
162  [[nodiscard]] QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
163  {
164  if (convertToFormat_inplace(f, flags))
165  return std::move(*this);
166  else
167  return convertToFormat_helper(f, flags);
168  }
169  [[nodiscard]] QImage convertToFormat(Format f, const QList<QRgb> &colorTable,
170  Qt::ImageConversionFlags flags = Qt::AutoColor) const;
171 
172  bool reinterpretAsFormat(Format f);
173  [[nodiscard]] QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
174  { return convertToFormat(f, flags); }
175  [[nodiscard]] QImage convertedTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
176  { return convertToFormat(f, flags); }
177  void convertTo(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor);
178 
179  int width() const;
180  int height() const;
181  QSize size() const;
182  QRect rect() const;
183 
184  int depth() const;
185  int colorCount() const;
186  int bitPlaneCount() const;
187 
188  QRgb color(int i) const;
189  void setColor(int i, QRgb c);
190  void setColorCount(int);
191 
192  bool allGray() const;
193  bool isGrayscale() const;
194 
195  uchar *bits();
196  const uchar *bits() const;
197  const uchar *constBits() const;
198 
199  qsizetype sizeInBytes() const;
200 
201  uchar *scanLine(int);
202  const uchar *scanLine(int) const;
203  const uchar *constScanLine(int) const;
204  qsizetype bytesPerLine() const;
205 
206  bool valid(int x, int y) const;
207  bool valid(const QPoint &pt) const;
208 
209  int pixelIndex(int x, int y) const;
210  int pixelIndex(const QPoint &pt) const;
211 
212  QRgb pixel(int x, int y) const;
213  QRgb pixel(const QPoint &pt) const;
214 
215  void setPixel(int x, int y, uint index_or_rgb);
216  void setPixel(const QPoint &pt, uint index_or_rgb);
217 
218  QColor pixelColor(int x, int y) const;
219  QColor pixelColor(const QPoint &pt) const;
220 
221  void setPixelColor(int x, int y, const QColor &c);
222  void setPixelColor(const QPoint &pt, const QColor &c);
223 
224  QList<QRgb> colorTable() const;
225  void setColorTable(const QList<QRgb> &colors);
226 
227  qreal devicePixelRatio() const;
228  void setDevicePixelRatio(qreal scaleFactor);
229  QSizeF deviceIndependentSize() const;
230 
231  void fill(uint pixel);
232  void fill(const QColor &color);
233  void fill(Qt::GlobalColor color);
234 
235 
236  bool hasAlphaChannel() const;
237  void setAlphaChannel(const QImage &alphaChannel);
238  [[nodiscard]] QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
239 #ifndef QT_NO_IMAGE_HEURISTIC_MASK
240  [[nodiscard]] QImage createHeuristicMask(bool clipTight = true) const;
241 #endif
242  [[nodiscard]] QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const;
243 
244  [[nodiscard]] QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
246  { return scaled(QSize(w, h), aspectMode, mode); }
247  [[nodiscard]] QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
249  [[nodiscard]] QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
250  [[nodiscard]] QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
251  [[nodiscard]] QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
252  static QTransform trueMatrix(const QTransform &, int w, int h);
253 
254  [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) const &
255  { return mirrored_helper(horizontally, vertically); }
256  [[nodiscard]] QImage mirrored(bool horizontally = false, bool vertically = true) &&
257  { mirrored_inplace(horizontally, vertically); return std::move(*this); }
258  [[nodiscard]] QImage rgbSwapped() const &
259  { return rgbSwapped_helper(); }
260  [[nodiscard]] QImage rgbSwapped() &&
261  { rgbSwapped_inplace(); return std::move(*this); }
262  void mirror(bool horizontally = false, bool vertically = true)
263  { mirrored_inplace(horizontally, vertically); }
264  void rgbSwap()
265  { rgbSwapped_inplace(); }
266  void invertPixels(InvertMode = InvertRgb);
267 
268  QColorSpace colorSpace() const;
269  [[nodiscard]] QImage convertedToColorSpace(const QColorSpace &) const;
270  void convertToColorSpace(const QColorSpace &);
271  void setColorSpace(const QColorSpace &);
272 
273  void applyColorTransform(const QColorTransform &transform);
274 
275  bool load(QIODevice *device, const char *format);
276  bool load(const QString &fileName, const char *format = nullptr);
277  bool loadFromData(QByteArrayView data, const char *format = nullptr);
278  bool loadFromData(const uchar *buf, int len, const char *format = nullptr); // ### Qt 7: qsizetype
279  bool loadFromData(const QByteArray &data, const char *format = nullptr) // ### Qt 7: drop
280  { return loadFromData(QByteArrayView(data), format); }
281 
282  bool save(const QString &fileName, const char *format = nullptr, int quality = -1) const;
283  bool save(QIODevice *device, const char *format = nullptr, int quality = -1) const;
284 
285  static QImage fromData(QByteArrayView data, const char *format = nullptr);
286  static QImage fromData(const uchar *data, int size, const char *format = nullptr); // ### Qt 7: qsizetype
287  static QImage fromData(const QByteArray &data, const char *format = nullptr) // ### Qt 7: drop
288  { return fromData(QByteArrayView(data), format); }
289 
290  qint64 cacheKey() const;
291 
292  QPaintEngine *paintEngine() const override;
293 
294  // Auxiliary data
295  int dotsPerMeterX() const;
296  int dotsPerMeterY() const;
297  void setDotsPerMeterX(int);
298  void setDotsPerMeterY(int);
299  QPoint offset() const;
300  void setOffset(const QPoint&);
301 
302  QStringList textKeys() const;
303  QString text(const QString &key = QString()) const;
304  void setText(const QString &key, const QString &value);
305 
306  QPixelFormat pixelFormat() const noexcept;
307  static QPixelFormat toPixelFormat(QImage::Format format) noexcept;
308  static QImage::Format toImageFormat(QPixelFormat format) noexcept;
309 
310  // Platform specific conversion functions
311 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
312  CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED;
313 #endif
314 #if defined(Q_OS_WIN) || defined(Q_QDOC)
315  HBITMAP toHBITMAP() const;
316  HICON toHICON(const QImage &mask = {}) const;
317  static QImage fromHBITMAP(HBITMAP hbitmap);
318  static QImage fromHICON(HICON icon);
319 #endif
320 
321 protected:
322  virtual int metric(PaintDeviceMetric metric) const override;
323  QImage mirrored_helper(bool horizontal, bool vertical) const;
324  QImage rgbSwapped_helper() const;
325  void mirrored_inplace(bool horizontal, bool vertical);
326  void rgbSwapped_inplace();
327  QImage convertToFormat_helper(Format format, Qt::ImageConversionFlags flags) const;
328  bool convertToFormat_inplace(Format format, Qt::ImageConversionFlags flags);
329  QImage smoothScaled(int w, int h) const;
330 
331 private:
332  QImageData *d;
333 
334  friend class QRasterPlatformPixmap;
336  friend class QPixmapCacheEntry;
337  friend struct QImageData;
338 
339 public:
340  typedef QImageData * DataPtr;
341  inline DataPtr &data_ptr() { return d; }
342 };
343 
345 
346 // Inline functions...
347 
348 inline bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); }
349 inline int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());}
350 inline QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); }
351 inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); }
352 inline QColor QImage::pixelColor(const QPoint &pt) const { return pixelColor(pt.x(), pt.y()); }
353 inline void QImage::setPixelColor(const QPoint &pt, const QColor &c) { setPixelColor(pt.x(), pt.y(), c); }
354 
355 // QImage stream functions
356 
357 #if !defined(QT_NO_DATASTREAM)
358 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &);
359 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &);
360 #endif
361 
362 #ifndef QT_NO_DEBUG_STREAM
363 Q_GUI_EXPORT QDebug operator<<(QDebug, const QImage &);
364 #endif
365 
366 
368 
369 #endif // QIMAGE_H
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QRgb
Definition: qrgb.h:49
The QColorSpace class provides a color space abstraction.
Definition: qcolorspace.h:57
The QColorTransform class is a transformation between color spaces.
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:66
operator>>(QDataStream &ds, qfloat16 &f)
Definition: qfloat16.cpp:344
operator<<(QDataStream &ds, qfloat16 f)
Definition: qfloat16.cpp:327
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:65
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:70
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:73
void mirror(bool horizontally=false, bool vertically=true)
Definition: qimage.h:262
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qimage.h:244
void setPixel(int x, int y, uint index_or_rgb)
Definition: qimage.cpp:2546
void setPixelColor(int x, int y, const QColor &c)
Definition: qimage.cpp:2743
QRgb pixel(int x, int y) const
Definition: qimage.cpp:2451
DataPtr & data_ptr()
Definition: qimage.h:341
bool loadFromData(const QByteArray &data, const char *format=nullptr)
Definition: qimage.h:279
void rgbSwap()
Definition: qimage.h:264
Format
Definition: qimage.h:77
@ Format_Grayscale16
Definition: qimage.h:106
@ Format_Alpha8
Definition: qimage.h:101
@ Format_RGBA8888
Definition: qimage.h:95
@ Format_RGB30
Definition: qimage.h:99
@ Format_RGB888
Definition: qimage.h:91
@ Format_RGBA16FPx4
Definition: qimage.h:109
@ Format_RGBA32FPx4_Premultiplied
Definition: qimage.h:113
@ Format_RGB32
Definition: qimage.h:82
@ Format_Invalid
Definition: qimage.h:78
@ Format_RGB666
Definition: qimage.h:87
@ Format_RGBX32FPx4
Definition: qimage.h:111
@ Format_RGBA64_Premultiplied
Definition: qimage.h:105
@ Format_ARGB6666_Premultiplied
Definition: qimage.h:88
@ Format_ARGB8555_Premultiplied
Definition: qimage.h:90
@ Format_RGB444
Definition: qimage.h:92
@ Format_MonoLSB
Definition: qimage.h:80
@ Format_RGBA8888_Premultiplied
Definition: qimage.h:96
@ Format_ARGB8565_Premultiplied
Definition: qimage.h:86
@ Format_RGB555
Definition: qimage.h:89
@ Format_RGBA64
Definition: qimage.h:104
@ Format_RGBA32FPx4
Definition: qimage.h:112
@ Format_Mono
Definition: qimage.h:79
@ Format_RGBA16FPx4_Premultiplied
Definition: qimage.h:110
@ Format_RGBX64
Definition: qimage.h:103
@ Format_A2BGR30_Premultiplied
Definition: qimage.h:98
@ Format_RGBX16FPx4
Definition: qimage.h:108
@ Format_Indexed8
Definition: qimage.h:81
@ Format_BGR30
Definition: qimage.h:97
@ Format_ARGB32_Premultiplied
Definition: qimage.h:84
@ Format_A2RGB30_Premultiplied
Definition: qimage.h:100
@ Format_ARGB4444_Premultiplied
Definition: qimage.h:93
@ Format_RGB16
Definition: qimage.h:85
@ Format_BGR888
Definition: qimage.h:107
@ Format_ARGB32
Definition: qimage.h:83
@ Format_RGBX8888
Definition: qimage.h:94
@ Format_Grayscale8
Definition: qimage.h:102
QImage convertedTo(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) &&
Definition: qimage.h:175
QImage mirrored(bool horizontally=false, bool vertically=true) &&
Definition: qimage.h:256
QImage mirrored(bool horizontally=false, bool vertically=true) const &
Definition: qimage.h:254
QColor pixelColor(int x, int y) const
Definition: qimage.cpp:2664
QImage rgbSwapped() const &
Definition: qimage.h:258
static QImage fromData(const QByteArray &data, const char *format=nullptr)
Definition: qimage.h:287
QImageCleanupFunction
QImage(QImage &&other) noexcept
Definition: qimage.h:134
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) &&
Definition: qimage.h:162
QImageData * DataPtr
Definition: qimage.h:340
QImage rgbSwapped() &&
Definition: qimage.h:260
int pixelIndex(int x, int y) const
Definition: qimage.cpp:2410
QImage convertedTo(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
Definition: qimage.h:173
InvertMode
Definition: qimage.h:76
QImage copy(int x, int y, int w, int h) const
Definition: qimage.h:155
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
Definition: qimage.h:160
virtual QPaintEngine * paintEngine() const =0
QPaintDevice() noexcept
qreal devicePixelRatio() const
Definition: qpaintdevice.h:85
int depth() const
Definition: qpaintdevice.h:88
virtual int devType() const
Definition: qpaintdevice.h:113
int colorCount() const
Definition: qpaintdevice.h:87
int width() const
Definition: qpaintdevice.h:77
virtual int metric(PaintDeviceMetric metric) const
int height() const
Definition: qpaintdevice.h:78
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:87
QPixelFormat is a class for describing different pixel layouts in graphics buffers.
Definition: qpixelformat.h:48
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
constexpr int x() const noexcept
Definition: qpoint.h:155
constexpr int y() const noexcept
Definition: qpoint.h:160
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
The QSizeF class defines the size of a two-dimensional object using floating point precision.
Definition: qsize.h:235
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
The QString class provides a Unicode character string.
Definition: qstring.h:388
The QStringList class provides a list of strings.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:56
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
p1 load("image.bmp")
rect
[4]
QColor colorTable[]
Definition: window.cpp:60
auto it unsigned count const
Definition: hb-iter.hh:848
#define bits
Definition: infblock.c:15
int quality
Definition: jpeglib.h:933
#define inline
Definition: md4c.c:45
@ AutoColor
Definition: qnamespace.h:503
TransformationMode
Definition: qnamespace.h:1349
@ FastTransformation
Definition: qnamespace.h:1350
AspectRatioMode
Definition: qnamespace.h:1211
@ IgnoreAspectRatio
Definition: qnamespace.h:1212
GlobalColor
Definition: qnamespace.h:58
MaskMode
Definition: qnamespace.h:1325
@ MaskInColor
Definition: qnamespace.h:1326
#define QString()
Definition: parse-defines.h:51
void
Definition: png.h:1080
#define Q_DECL_CF_RETURNS_RETAINED
constexpr bool operator!=(const timespec &t1, const timespec &t2)
Definition: qcore_unix_p.h:124
EGLOutputLayerEXT EGLint EGLAttrib value
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
Definition: qglobal.h:332
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
ptrdiff_t qsizetype
Definition: qglobal.h:308
unsigned int uint
Definition: qglobal.h:334
long long qint64
Definition: qglobal.h:298
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Class)
Definition: qglobal.h:556
@ text
void(* QImageCleanupFunction)(void *)
Definition: qimage.h:70
Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGContext)
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
GLint GLint GLint GLint GLint x
[0]
GLenum mode
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat f
GLint GLsizei width
GLuint color
[2]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
Definition: qopenglext.h:11564
const GLubyte * c
Definition: qopenglext.h:12701
GLenum GLsizei len
Definition: qopenglext.h:3292
GLuint GLenum matrix
Definition: qopenglext.h:11564
GLdouble s
[6]
Definition: qopenglext.h:235
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition: qrgb.h:49
#define Q_ENUM(x)
Definition: qtmetamacros.h:104
#define Q_GADGET
Definition: qtmetamacros.h:193
#define Q_DECLARE_SHARED(TYPE)
Definition: qtypeinfo.h:197
QImage scaled(const QImage &image)
[0]
QIcon icon
[15]
MyClass setText
ba fill(true)
QSharedPointer< T > other(t)
[5]
this swap(other)
myFilter setColor(QColor(128, 0, 0))