API reference - Class QPixmap

Notation used in Ruby API documentation

Module: QtGui

Description: Binding of QPixmap

Class hierarchy: QPixmap » QPaintDevice

Public constructors

new QPixmapnewConstructor QPixmap::QPixmap()
new QPixmapnew(int w,
int h)
Constructor QPixmap::QPixmap(int w, int h)
new QPixmapnew(const QSize arg1)Constructor QPixmap::QPixmap(const QSize &)
new QPixmapnew(string fileName,
string format = nullptr,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Constructor QPixmap::QPixmap(const QString &fileName, const char *format, QFlags<Qt::ImageConversionFlag> flags)
new QPixmapnew(const QPixmap arg1)Constructor QPixmap::QPixmap(const QPixmap &)

Public methods

[const]bool!Method bool QPixmap::operator!()
void_assign(const QPixmap other)Assigns another object to self
[const]QPixmap ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]new QPixmap ptr_dupCreates a copy of self
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
QPixmapassign(const QPixmap arg1)Method QPixmap &QPixmap::operator=(const QPixmap &)
[const]long longcacheKeyMethod qint64 QPixmap::cacheKey()
boolconvertFromImage(const QImage img,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Method bool QPixmap::convertFromImage(const QImage &img, QFlags<Qt::ImageConversionFlag> flags)
[const]QPixmapcopy(int x,
int y,
int width,
int height)
Method QPixmap QPixmap::copy(int x, int y, int width, int height)
[const]QPixmapcopy(const QRect rect = QRect())Method QPixmap QPixmap::copy(const QRect &rect)
[const]QBitmapcreateHeuristicMask(bool clipTight = true)Method QBitmap QPixmap::createHeuristicMask(bool clipTight)
[const]QBitmapcreateMaskFromColor(const QColor maskColor,
const Qt_MaskMode mode = Qt::MaskInColor)
Method QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode)
[const]intdepthMethod int QPixmap::depth()
voiddetachMethod void QPixmap::detach()
[const]doubledevicePixelRatioMethod double QPixmap::devicePixelRatio()
voiddevicePixelRatio=(double scaleFactor)Method void QPixmap::setDevicePixelRatio(double scaleFactor)
[const]new QPixmap ptrdupCreates a copy of self
voidfill(const QColor fillColor = Qt::white)Method void QPixmap::fill(const QColor &fillColor)
voidfill(const QPaintDevice ptr device,
const QPoint ofs)
Method void QPixmap::fill(const QPaintDevice *device, const QPoint &ofs)
voidfill(const QPaintDevice ptr device,
int xofs,
int yofs)
Method void QPixmap::fill(const QPaintDevice *device, int xofs, int yofs)
[const]boolhasAlphaMethod bool QPixmap::hasAlpha()
[const]boolhasAlphaChannelMethod bool QPixmap::hasAlphaChannel()
[const]intheightMethod int QPixmap::height()
[const]boolisDetached?Method bool QPixmap::isDetached()
[const]boolisNull?Method bool QPixmap::isNull()
[const]boolisQBitmap?Method bool QPixmap::isQBitmap()
boolload(string fileName,
string format = nullptr,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Method bool QPixmap::load(const QString &fileName, const char *format, QFlags<Qt::ImageConversionFlag> flags)
boolloadFromData(string buf,
unsigned int len,
string format = nullptr,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Method bool QPixmap::loadFromData(const unsigned char *buf, unsigned int len, const char *format, QFlags<Qt::ImageConversionFlag> flags)
boolloadFromData(bytes data,
string format = nullptr,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Method bool QPixmap::loadFromData(const QByteArray &data, const char *format, QFlags<Qt::ImageConversionFlag> flags)
[const]QBitmapmaskMethod QBitmap QPixmap::mask()
voidmask=(const QBitmap arg1)Method void QPixmap::setMask(const QBitmap &)
[const]QPaintEngine ptrpaintEngineVirtual method QPaintEngine *QPixmap::paintEngine()
[const]QRectrectMethod QRect QPixmap::rect()
[const]boolsave(string fileName,
string format = nullptr,
int quality = -1)
Method bool QPixmap::save(const QString &fileName, const char *format, int quality)
[const]boolsave(QIODevice ptr device,
string format = nullptr,
int quality = -1)
Method bool QPixmap::save(QIODevice *device, const char *format, int quality)
[const]QPixmapscaled(int w,
int h,
const Qt_AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::scaled(int w, int h, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode)
[const]QPixmapscaled(const QSize s,
const Qt_AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::scaled(const QSize &s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode)
[const]QPixmapscaledToHeight(int h,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode)
[const]QPixmapscaledToWidth(int w,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode)
voidscroll(int dx,
int dy,
int x,
int y,
int width,
int height,
QRegion ptr exposed = nullptr)
Method void QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed)
voidscroll(int dx,
int dy,
const QRect rect,
QRegion ptr exposed = nullptr)
Method void QPixmap::scroll(int dx, int dy, const QRect &rect, QRegion *exposed)
voidsetDevicePixelRatio(double scaleFactor)Method void QPixmap::setDevicePixelRatio(double scaleFactor)
voidsetMask(const QBitmap arg1)Method void QPixmap::setMask(const QBitmap &)
[const]QSizesizeMethod QSize QPixmap::size()
voidswap(QPixmap other)Method void QPixmap::swap(QPixmap &other)
[const]QImagetoImageMethod QImage QPixmap::toImage()
[const]QPixmaptransformed(const QMatrix arg1,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::transformed(const QMatrix &, Qt::TransformationMode mode)
[const]QPixmaptransformed(const QTransform arg1,
const Qt_TransformationMode mode = Qt::FastTransformation)
Method QPixmap QPixmap::transformed(const QTransform &, Qt::TransformationMode mode)
[const]intwidthMethod int QPixmap::width()

Public static methods and constants

intdefaultDepthStatic method int QPixmap::defaultDepth()
QPixmapfromImage(const QImage image,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Static method QPixmap QPixmap::fromImage(const QImage &image, QFlags<Qt::ImageConversionFlag> flags)
QPixmapfromImageReader(QImageReader ptr imageReader,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Static method QPixmap QPixmap::fromImageReader(QImageReader *imageReader, QFlags<Qt::ImageConversionFlag> flags)
QPixmapgrabWidget(QObject ptr widget,
const QRect rect)
Static method QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rect)
QPixmapgrabWidget(QObject ptr widget,
int x = 0,
int y = 0,
int w = -1,
int h = -1)
Static method QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)
QPixmapgrabWindow(unsigned long long arg1,
int x = 0,
int y = 0,
int w = -1,
int h = -1)
Static method QPixmap QPixmap::grabWindow(WId, int x, int y, int w, int h)
QMatrixtrueMatrix(const QMatrix m,
int w,
int h)
Static method QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
QTransformtrueMatrix(const QTransform m,
int w,
int h)
Static method QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h)

Protected methods (static, non-static and constructors)

[static]QPixmapfromImageInPlace(QImage image,
Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)
Method QPixmap QPixmap::fromImageInPlace(QImage &image, QFlags<Qt::ImageConversionFlag> flags)
[const]voidinitPainter(QPainter ptr painter)Virtual method void QPixmap::initPainter(QPainter *painter)
[const]intmetric(const QPaintDevice_PaintDeviceMetric arg1)Virtual method int QPixmap::metric(QPaintDevice::PaintDeviceMetric)
[const]QPaintDevice ptrredirected(QPoint ptr offset)Virtual method QPaintDevice *QPixmap::redirected(QPoint *offset)
[const]QPainter ptrsharedPainterVirtual method QPainter *QPixmap::sharedPainter()

Detailed description

!

Signature: [const] bool !

Description: Method bool QPixmap::operator!()

_assign

Signature: void _assign (const QPixmap other)

Description: Assigns another object to self

_const_cast

Signature: [const] QPixmap ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_dup

Signature: [const] new QPixmap ptr _dup

Description: Creates a copy of self

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

assign

Signature: QPixmap assign (const QPixmap arg1)

Description: Method QPixmap &QPixmap::operator=(const QPixmap &)

cacheKey

Signature: [const] long long cacheKey

Description: Method qint64 QPixmap::cacheKey()

convertFromImage

Signature: bool convertFromImage (const QImage img, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Method bool QPixmap::convertFromImage(const QImage &img, QFlags<Qt::ImageConversionFlag> flags)

copy

(1) Signature: [const] QPixmap copy (int x, int y, int width, int height)

Description: Method QPixmap QPixmap::copy(int x, int y, int width, int height)

(2) Signature: [const] QPixmap copy (const QRect rect = QRect())

Description: Method QPixmap QPixmap::copy(const QRect &rect)

createHeuristicMask

Signature: [const] QBitmap createHeuristicMask (bool clipTight = true)

Description: Method QBitmap QPixmap::createHeuristicMask(bool clipTight)

createMaskFromColor

Signature: [const] QBitmap createMaskFromColor (const QColor maskColor, const Qt_MaskMode mode = Qt::MaskInColor)

Description: Method QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode)

defaultDepth

Signature: [static] int defaultDepth

Description: Static method int QPixmap::defaultDepth()

This method is static and can be called without an instance.

depth

Signature: [const] int depth

Description: Method int QPixmap::depth()

detach

Signature: void detach

Description: Method void QPixmap::detach()

devicePixelRatio

Signature: [const] double devicePixelRatio

Description: Method double QPixmap::devicePixelRatio()

Python specific notes:
The object exposes a readable attribute 'devicePixelRatio'. This is the getter.

devicePixelRatio=

Signature: void devicePixelRatio= (double scaleFactor)

Description: Method void QPixmap::setDevicePixelRatio(double scaleFactor)

Python specific notes:
The object exposes a writable attribute 'devicePixelRatio'. This is the setter.

dup

Signature: [const] new QPixmap ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

fill

(1) Signature: void fill (const QColor fillColor = Qt::white)

Description: Method void QPixmap::fill(const QColor &fillColor)

(2) Signature: void fill (const QPaintDevice ptr device, const QPoint ofs)

Description: Method void QPixmap::fill(const QPaintDevice *device, const QPoint &ofs)

(3) Signature: void fill (const QPaintDevice ptr device, int xofs, int yofs)

Description: Method void QPixmap::fill(const QPaintDevice *device, int xofs, int yofs)

fromImage

Signature: [static] QPixmap fromImage (const QImage image, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Static method QPixmap QPixmap::fromImage(const QImage &image, QFlags<Qt::ImageConversionFlag> flags)

This method is static and can be called without an instance.

fromImageInPlace

Signature: [static] QPixmap fromImageInPlace (QImage image, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Method QPixmap QPixmap::fromImageInPlace(QImage &image, QFlags<Qt::ImageConversionFlag> flags)

This method is protected and can only be called from inside a derived class.

fromImageReader

Signature: [static] QPixmap fromImageReader (QImageReader ptr imageReader, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Static method QPixmap QPixmap::fromImageReader(QImageReader *imageReader, QFlags<Qt::ImageConversionFlag> flags)

This method is static and can be called without an instance.

grabWidget

(1) Signature: [static] QPixmap grabWidget (QObject ptr widget, const QRect rect)

Description: Static method QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rect)

This method is static and can be called without an instance.

(2) Signature: [static] QPixmap grabWidget (QObject ptr widget, int x = 0, int y = 0, int w = -1, int h = -1)

Description: Static method QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)

This method is static and can be called without an instance.

grabWindow

Signature: [static] QPixmap grabWindow (unsigned long long arg1, int x = 0, int y = 0, int w = -1, int h = -1)

Description: Static method QPixmap QPixmap::grabWindow(WId, int x, int y, int w, int h)

This method is static and can be called without an instance.

hasAlpha

Signature: [const] bool hasAlpha

Description: Method bool QPixmap::hasAlpha()

hasAlphaChannel

Signature: [const] bool hasAlphaChannel

Description: Method bool QPixmap::hasAlphaChannel()

height

Signature: [const] int height

Description: Method int QPixmap::height()

initPainter

Signature: [const] void initPainter (QPainter ptr painter)

Description: Virtual method void QPixmap::initPainter(QPainter *painter)

This method can be reimplemented in a derived class.

isDetached?

Signature: [const] bool isDetached?

Description: Method bool QPixmap::isDetached()

isNull?

Signature: [const] bool isNull?

Description: Method bool QPixmap::isNull()

isQBitmap?

Signature: [const] bool isQBitmap?

Description: Method bool QPixmap::isQBitmap()

load

Signature: bool load (string fileName, string format = nullptr, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Method bool QPixmap::load(const QString &fileName, const char *format, QFlags<Qt::ImageConversionFlag> flags)

loadFromData

(1) Signature: bool loadFromData (string buf, unsigned int len, string format = nullptr, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Method bool QPixmap::loadFromData(const unsigned char *buf, unsigned int len, const char *format, QFlags<Qt::ImageConversionFlag> flags)

(2) Signature: bool loadFromData (bytes data, string format = nullptr, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Method bool QPixmap::loadFromData(const QByteArray &data, const char *format, QFlags<Qt::ImageConversionFlag> flags)

mask

Signature: [const] QBitmap mask

Description: Method QBitmap QPixmap::mask()

Python specific notes:
The object exposes a readable attribute 'mask'. This is the getter.

mask=

Signature: void mask= (const QBitmap arg1)

Description: Method void QPixmap::setMask(const QBitmap &)

Python specific notes:
The object exposes a writable attribute 'mask'. This is the setter.

metric

Signature: [const] int metric (const QPaintDevice_PaintDeviceMetric arg1)

Description: Virtual method int QPixmap::metric(QPaintDevice::PaintDeviceMetric)

This method can be reimplemented in a derived class.

new

(1) Signature: [static] new QPixmap new

Description: Constructor QPixmap::QPixmap()

This method creates an object of class QPixmap.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new QPixmap new (int w, int h)

Description: Constructor QPixmap::QPixmap(int w, int h)

This method creates an object of class QPixmap.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new QPixmap new (const QSize arg1)

Description: Constructor QPixmap::QPixmap(const QSize &)

This method creates an object of class QPixmap.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new QPixmap new (string fileName, string format = nullptr, Qt_QFlags_ImageConversionFlag flags = Qt::AutoColor)

Description: Constructor QPixmap::QPixmap(const QString &fileName, const char *format, QFlags<Qt::ImageConversionFlag> flags)

This method creates an object of class QPixmap.

Python specific notes:
This method is the default initializer of the object.

(5) Signature: [static] new QPixmap new (const QPixmap arg1)

Description: Constructor QPixmap::QPixmap(const QPixmap &)

This method creates an object of class QPixmap.

Python specific notes:
This method is the default initializer of the object.

paintEngine

Signature: [const] QPaintEngine ptr paintEngine

Description: Virtual method QPaintEngine *QPixmap::paintEngine()

This method can be reimplemented in a derived class.

rect

Signature: [const] QRect rect

Description: Method QRect QPixmap::rect()

redirected

Signature: [const] QPaintDevice ptr redirected (QPoint ptr offset)

Description: Virtual method QPaintDevice *QPixmap::redirected(QPoint *offset)

This method can be reimplemented in a derived class.

save

(1) Signature: [const] bool save (string fileName, string format = nullptr, int quality = -1)

Description: Method bool QPixmap::save(const QString &fileName, const char *format, int quality)

(2) Signature: [const] bool save (QIODevice ptr device, string format = nullptr, int quality = -1)

Description: Method bool QPixmap::save(QIODevice *device, const char *format, int quality)

scaled

(1) Signature: [const] QPixmap scaled (int w, int h, const Qt_AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::scaled(int w, int h, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode)

(2) Signature: [const] QPixmap scaled (const QSize s, const Qt_AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::scaled(const QSize &s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode)

scaledToHeight

Signature: [const] QPixmap scaledToHeight (int h, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode)

scaledToWidth

Signature: [const] QPixmap scaledToWidth (int w, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode)

scroll

(1) Signature: void scroll (int dx, int dy, int x, int y, int width, int height, QRegion ptr exposed = nullptr)

Description: Method void QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed)

(2) Signature: void scroll (int dx, int dy, const QRect rect, QRegion ptr exposed = nullptr)

Description: Method void QPixmap::scroll(int dx, int dy, const QRect &rect, QRegion *exposed)

setDevicePixelRatio

Signature: void setDevicePixelRatio (double scaleFactor)

Description: Method void QPixmap::setDevicePixelRatio(double scaleFactor)

Python specific notes:
The object exposes a writable attribute 'devicePixelRatio'. This is the setter.

setMask

Signature: void setMask (const QBitmap arg1)

Description: Method void QPixmap::setMask(const QBitmap &)

Python specific notes:
The object exposes a writable attribute 'mask'. This is the setter.

sharedPainter

Signature: [const] QPainter ptr sharedPainter

Description: Virtual method QPainter *QPixmap::sharedPainter()

This method can be reimplemented in a derived class.

size

Signature: [const] QSize size

Description: Method QSize QPixmap::size()

Python specific notes:
This method is also available as 'len(object)'.

swap

Signature: void swap (QPixmap other)

Description: Method void QPixmap::swap(QPixmap &other)

toImage

Signature: [const] QImage toImage

Description: Method QImage QPixmap::toImage()

transformed

(1) Signature: [const] QPixmap transformed (const QMatrix arg1, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::transformed(const QMatrix &, Qt::TransformationMode mode)

(2) Signature: [const] QPixmap transformed (const QTransform arg1, const Qt_TransformationMode mode = Qt::FastTransformation)

Description: Method QPixmap QPixmap::transformed(const QTransform &, Qt::TransformationMode mode)

trueMatrix

(1) Signature: [static] QMatrix trueMatrix (const QMatrix m, int w, int h)

Description: Static method QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)

This method is static and can be called without an instance.

(2) Signature: [static] QTransform trueMatrix (const QTransform m, int w, int h)

Description: Static method QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h)

This method is static and can be called without an instance.

width

Signature: [const] int width

Description: Method int QPixmap::width()