Remove deprecated members from QtGui/image classes
Cleaning up those that are trivial to remove because they have direct replacements. Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
0303d8ddfa
commit
0fda43cf33
@ -785,24 +785,6 @@ QIcon::operator QVariant() const
|
||||
return QVariant(QMetaType::QIcon, this);
|
||||
}
|
||||
|
||||
/*! \fn int QIcon::serialNumber() const
|
||||
\obsolete
|
||||
|
||||
Returns a number that identifies the contents of this
|
||||
QIcon object. Distinct QIcon objects can have
|
||||
the same serial number if they refer to the same contents
|
||||
(but they don't have to). Also, the serial number of
|
||||
a QIcon object may change during its lifetime.
|
||||
|
||||
Use cacheKey() instead.
|
||||
|
||||
A null icon always has a serial number of 0.
|
||||
|
||||
Serial numbers are mostly useful in conjunction with caching.
|
||||
|
||||
\sa QPixmap::serialNumber()
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns a number that identifies the contents of this QIcon
|
||||
object. Distinct QIcon objects can have the same key if
|
||||
|
@ -95,9 +95,6 @@ public:
|
||||
bool isDetached() const;
|
||||
void detach();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
|
||||
#endif
|
||||
qint64 cacheKey() const;
|
||||
|
||||
void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off);
|
||||
|
@ -51,7 +51,6 @@ class Q_GUI_EXPORT QIconEngine
|
||||
{
|
||||
public:
|
||||
QIconEngine();
|
||||
QIconEngine(const QIconEngine &other); // ### Qt6: make protected
|
||||
virtual ~QIconEngine();
|
||||
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0;
|
||||
virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
|
||||
@ -93,14 +92,13 @@ public:
|
||||
// ### Qt6: move content to proper virtual functions
|
||||
virtual void virtual_hook(int id, void *data);
|
||||
|
||||
protected:
|
||||
QIconEngine(const QIconEngine &other);
|
||||
|
||||
private:
|
||||
QIconEngine &operator=(const QIconEngine &other) = delete;
|
||||
};
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
typedef QIconEngine QIconEngineV2;
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QICONENGINE_H
|
||||
|
@ -4314,99 +4314,6 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
|
||||
painter.drawImage(rect(), sourceImage);
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Returns the alpha channel of the image as a new grayscale QImage in which
|
||||
each pixel's red, green, and blue values are given the alpha value of the
|
||||
original image. The color depth of the returned image is 8-bit.
|
||||
|
||||
You can see an example of use of this function in QPixmap's
|
||||
\l{QPixmap::}{alphaChannel()}, which works in the same way as
|
||||
this function on QPixmaps.
|
||||
|
||||
Most usecases for this function can be replaced with QPainter and
|
||||
using composition modes.
|
||||
|
||||
Note this returns a color-indexed image if you want the alpha channel in
|
||||
the alpha8 format instead use convertToFormat(Format_Alpha8) on the source
|
||||
image.
|
||||
|
||||
\warning This is an expensive function.
|
||||
|
||||
\sa setAlphaChannel(), hasAlphaChannel(), convertToFormat(),
|
||||
{QPixmap#Pixmap Information}{Pixmap},
|
||||
{QImage#Image Transformations}{Image Transformations}
|
||||
*/
|
||||
|
||||
QImage QImage::alphaChannel() const
|
||||
{
|
||||
if (!d)
|
||||
return QImage();
|
||||
|
||||
int w = d->width;
|
||||
int h = d->height;
|
||||
|
||||
QImage image(w, h, Format_Indexed8);
|
||||
image.setColorCount(256);
|
||||
|
||||
// set up gray scale table.
|
||||
for (int i=0; i<256; ++i)
|
||||
image.setColor(i, qRgb(i, i, i));
|
||||
|
||||
if (!hasAlphaChannel()) {
|
||||
image.fill(255);
|
||||
return image;
|
||||
}
|
||||
|
||||
if (d->format == Format_Indexed8) {
|
||||
const uchar *src_data = d->data;
|
||||
uchar *dest_data = image.d->data;
|
||||
for (int y=0; y<h; ++y) {
|
||||
const uchar *src = src_data;
|
||||
uchar *dest = dest_data;
|
||||
for (int x=0; x<w; ++x) {
|
||||
*dest = qAlpha(d->colortable.at(*src));
|
||||
++dest;
|
||||
++src;
|
||||
}
|
||||
src_data += d->bytes_per_line;
|
||||
dest_data += image.d->bytes_per_line;
|
||||
}
|
||||
} else if (d->format == Format_Alpha8) {
|
||||
const uchar *src_data = d->data;
|
||||
uchar *dest_data = image.d->data;
|
||||
memcpy(dest_data, src_data, d->bytes_per_line * h);
|
||||
} else {
|
||||
QImage alpha32 = *this;
|
||||
bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied);
|
||||
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
canSkipConversion = canSkipConversion || (d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied);
|
||||
#endif
|
||||
if (!canSkipConversion)
|
||||
alpha32 = convertToFormat(Format_ARGB32);
|
||||
|
||||
const uchar *src_data = alpha32.d->data;
|
||||
uchar *dest_data = image.d->data;
|
||||
for (int y=0; y<h; ++y) {
|
||||
const QRgb *src = (const QRgb *) src_data;
|
||||
uchar *dest = dest_data;
|
||||
for (int x=0; x<w; ++x) {
|
||||
*dest = qAlpha(*src);
|
||||
++dest;
|
||||
++src;
|
||||
}
|
||||
src_data += alpha32.d->bytes_per_line;
|
||||
dest_data += image.d->bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Returns \c true if the image has a format that respects the alpha
|
||||
channel, otherwise returns \c false.
|
||||
|
@ -229,10 +229,6 @@ public:
|
||||
|
||||
bool hasAlphaChannel() const;
|
||||
void setAlphaChannel(const QImage &alphaChannel);
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use convertToFormat(QImage::Format_Alpha8)")
|
||||
QImage alphaChannel() const;
|
||||
#endif
|
||||
QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
||||
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
|
||||
QImage createHeuristicMask(bool clipTight = true) const;
|
||||
|
@ -1149,43 +1149,6 @@ bool QImageReader::autoTransform() const
|
||||
return false;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\since 5.6
|
||||
\obsolete Use QColorSpace conversion on the QImage instead.
|
||||
|
||||
This is an image format specific function that forces images with
|
||||
gamma information to be gamma corrected to \a gamma. For image formats
|
||||
that do not support gamma correction, this value is ignored.
|
||||
|
||||
To gamma correct to a standard PC color-space, set gamma to \c 1/2.2.
|
||||
|
||||
\sa gamma()
|
||||
*/
|
||||
void QImageReader::setGamma(float gamma)
|
||||
{
|
||||
if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma))
|
||||
d->handler->setOption(QImageIOHandler::Gamma, gamma);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.6
|
||||
\obsolete Use QImage::colorSpace() and QColorSpace::gamma() instead.
|
||||
|
||||
Returns the gamma level of the decoded image. If setGamma() has been
|
||||
called and gamma correction is supported it will return the gamma set.
|
||||
If gamma level is not supported by the image format, \c 0.0 is returned.
|
||||
|
||||
\sa setGamma()
|
||||
*/
|
||||
float QImageReader::gamma() const
|
||||
{
|
||||
if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::Gamma))
|
||||
return d->handler->option(QImageIOHandler::Gamma).toFloat();
|
||||
return 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Returns \c true if an image can be read for the device (i.e., the
|
||||
image format is supported, and the device seems to contain valid
|
||||
|
@ -117,13 +117,6 @@ public:
|
||||
void setAutoTransform(bool enabled);
|
||||
bool autoTransform() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead")
|
||||
void setGamma(float gamma);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead")
|
||||
float gamma() const;
|
||||
#endif
|
||||
|
||||
QByteArray subType() const;
|
||||
QList<QByteArray> supportedSubTypes() const;
|
||||
|
||||
|
@ -497,37 +497,6 @@ int QImageWriter::compression() const
|
||||
return d->compression;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\obsolete Use QColorSpace conversion on the QImage instead.
|
||||
|
||||
This is an image format specific function that sets the gamma
|
||||
level of the image to \a gamma. For image formats that do not
|
||||
support setting the gamma level, this value is ignored.
|
||||
|
||||
The value range of \a gamma depends on the image format. For
|
||||
example, the "png" format supports a gamma range from 0.0 to 1.0.
|
||||
|
||||
\sa quality()
|
||||
*/
|
||||
void QImageWriter::setGamma(float gamma)
|
||||
{
|
||||
d->gamma = gamma;
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete Use QImage::colorSpace() and QColorSpace::gamma() instead.
|
||||
|
||||
Returns the gamma level of the image.
|
||||
|
||||
\sa setGamma()
|
||||
*/
|
||||
float QImageWriter::gamma() const
|
||||
{
|
||||
return d->gamma;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 5.4
|
||||
|
||||
@ -653,40 +622,6 @@ QImageIOHandler::Transformations QImageWriter::transformation() const
|
||||
return d->transformation;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use setText() instead.
|
||||
|
||||
This is an image format specific function that sets the
|
||||
description of the image to \a description. For image formats that
|
||||
do not support setting the description, this value is ignored.
|
||||
|
||||
The contents of \a description depends on the image format.
|
||||
|
||||
\sa description()
|
||||
*/
|
||||
void QImageWriter::setDescription(const QString &description)
|
||||
{
|
||||
d->description = description;
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use QImageReader::text() instead.
|
||||
|
||||
Returns the description of the image.
|
||||
|
||||
\sa setDescription()
|
||||
*/
|
||||
QString QImageWriter::description() const
|
||||
{
|
||||
return d->description;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
|
@ -84,13 +84,6 @@ public:
|
||||
void setCompression(int compression);
|
||||
int compression() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead")
|
||||
void setGamma(float gamma);
|
||||
QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead")
|
||||
float gamma() const;
|
||||
#endif
|
||||
|
||||
void setSubType(const QByteArray &type);
|
||||
QByteArray subType() const;
|
||||
QList<QByteArray> supportedSubTypes() const;
|
||||
@ -104,13 +97,6 @@ public:
|
||||
QImageIOHandler::Transformations transformation() const;
|
||||
void setTransformation(QImageIOHandler::Transformations orientation);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QImageWriter::setText() instead")
|
||||
void setDescription(const QString &description);
|
||||
QT_DEPRECATED_X("Use QImageReader::text() instead")
|
||||
QString description() const;
|
||||
#endif
|
||||
|
||||
void setText(const QString &key, const QString &text);
|
||||
|
||||
bool canWrite() const;
|
||||
|
@ -845,37 +845,6 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use QPainter or the fill(QColor) overload instead.
|
||||
*/
|
||||
|
||||
void QPixmap::fill(const QPaintDevice *device, const QPoint &p)
|
||||
{
|
||||
Q_UNUSED(device)
|
||||
Q_UNUSED(p)
|
||||
qWarning("this function is deprecated, ignored");
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn void QPixmap::fill(const QPaintDevice *device, int x, int y)
|
||||
\obsolete
|
||||
|
||||
Use QPainter or the fill(QColor) overload instead.
|
||||
*/
|
||||
void QPixmap::fill(const QPaintDevice *device, int xofs, int yofs)
|
||||
{
|
||||
Q_UNUSED(device)
|
||||
Q_UNUSED(xofs)
|
||||
Q_UNUSED(yofs)
|
||||
qWarning("this function is deprecated, ignored");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
Fills the pixmap with the given \a color.
|
||||
|
||||
@ -911,21 +880,6 @@ void QPixmap::fill(const QColor &color)
|
||||
data->fill(color);
|
||||
}
|
||||
|
||||
/*! \fn int QPixmap::serialNumber() const
|
||||
\obsolete
|
||||
Returns a number that identifies the contents of this QPixmap
|
||||
object. Distinct QPixmap objects can only have the same serial
|
||||
number if they refer to the same contents (but they don't have
|
||||
to).
|
||||
|
||||
Use cacheKey() instead.
|
||||
|
||||
\warning The serial number doesn't necessarily change when
|
||||
the pixmap is altered. This means that it may be dangerous to use
|
||||
it as a cache key. For caching pixmaps, we recommend using the
|
||||
QPixmapCache class whenever possible.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns a number that identifies this QPixmap. Distinct QPixmap
|
||||
objects can only have the same cache key if they refer to the same
|
||||
@ -957,38 +911,6 @@ static void sendResizeEvents(QWidget *target)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use QWidget::grab() instead.
|
||||
*/
|
||||
QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
qWarning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead");
|
||||
if (!widget)
|
||||
return pixmap;
|
||||
QMetaObject::invokeMethod(widget, "grab", Qt::DirectConnection,
|
||||
Q_RETURN_ARG(QPixmap, pixmap),
|
||||
Q_ARG(QRect, rectangle));
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)
|
||||
\obsolete
|
||||
|
||||
Use QWidget::grab() instead.
|
||||
*/
|
||||
QPixmap QPixmap::grabWidget(QObject *widget, int x, int y, int w, int h)
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
return grabWidget(widget, QRect(x, y, w, h));
|
||||
QT_WARNING_POP
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
QPixmap stream functions
|
||||
@ -1582,62 +1504,6 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF
|
||||
return QPixmap(data.take());
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int
|
||||
width, int height)
|
||||
|
||||
Creates and returns a pixmap constructed by grabbing the contents
|
||||
of the given \a window restricted by QRect(\a x, \a y, \a width,
|
||||
\a height).
|
||||
|
||||
The arguments (\a{x}, \a{y}) specify the offset in the window,
|
||||
whereas (\a{width}, \a{height}) specify the area to be copied. If
|
||||
\a width is negative, the function copies everything to the right
|
||||
border of the window. If \a height is negative, the function
|
||||
copies everything to the bottom of the window.
|
||||
|
||||
The window system identifier (\c WId) can be retrieved using the
|
||||
QWidget::winId() function. The rationale for using a window
|
||||
identifier and not a QWidget, is to enable grabbing of windows
|
||||
that are not part of the application, window system frames, and so
|
||||
on.
|
||||
|
||||
The grabWindow() function grabs pixels from the screen, not from
|
||||
the window, i.e. if there is another window partially or entirely
|
||||
over the one you grab, you get pixels from the overlying window,
|
||||
too. The mouse cursor is generally not grabbed.
|
||||
|
||||
Note on X11 that if the given \a window doesn't have the same depth
|
||||
as the root window, and another window partially or entirely
|
||||
obscures the one you grab, you will \e not get pixels from the
|
||||
overlying window. The contents of the obscured areas in the
|
||||
pixmap will be undefined and uninitialized.
|
||||
|
||||
On Windows Vista and above grabbing a layered window, which is
|
||||
created by setting the Qt::WA_TranslucentBackground attribute, will
|
||||
not work. Instead grabbing the desktop widget should work.
|
||||
|
||||
\warning In general, grabbing an area outside the screen is not
|
||||
safe. This depends on the underlying window system.
|
||||
|
||||
\warning The function is deprecated in Qt 5.0 since there might be
|
||||
platform plugins in which window system identifiers (\c WId)
|
||||
are local to a screen. Use QScreen::grabWindow() instead.
|
||||
|
||||
\sa grabWidget(), {Screenshot Example}
|
||||
\sa QScreen
|
||||
\deprecated
|
||||
*/
|
||||
|
||||
QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
|
||||
{
|
||||
qWarning("this function is deprecated, use QScreen::grabWindow() instead."
|
||||
" Defaulting to primary screen.");
|
||||
return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
@ -1665,16 +1531,4 @@ QDebug operator<<(QDebug dbg, const QPixmap &r)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn QPixmap QPixmap::alphaChannel() const
|
||||
|
||||
Most use cases for this can be achieved using a QPainter and QPainter::CompositionMode instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QPixmap::setAlphaChannel(const QPixmap &p)
|
||||
|
||||
Most use cases for this can be achieved using \a p with QPainter and QPainter::CompositionMode instead.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -92,12 +92,6 @@ public:
|
||||
static int defaultDepth();
|
||||
|
||||
void fill(const QColor &fillColor = Qt::white);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QPainter or fill(QColor)")
|
||||
void fill(const QPaintDevice *device, const QPoint &ofs);
|
||||
QT_DEPRECATED_X("Use QPainter or fill(QColor)")
|
||||
void fill(const QPaintDevice *device, int xofs, int yofs);
|
||||
#endif
|
||||
|
||||
QBitmap mask() const;
|
||||
void setMask(const QBitmap &);
|
||||
@ -113,15 +107,6 @@ public:
|
||||
#endif
|
||||
QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QScreen::grabWindow() instead")
|
||||
static QPixmap grabWindow(WId, int x = 0, int y = 0, int w = -1, int h = -1);
|
||||
QT_DEPRECATED_X("Use QWidget::grab() instead")
|
||||
static QPixmap grabWidget(QObject *widget, const QRect &rect);
|
||||
QT_DEPRECATED_X("Use QWidget::grab() instead")
|
||||
static QPixmap grabWidget(QObject *widget, int x = 0, int y = 0, int w = -1, int h = -1);
|
||||
#endif
|
||||
|
||||
inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
|
||||
Qt::TransformationMode mode = Qt::FastTransformation) const
|
||||
{ return scaled(QSize(w, h), aspectMode, mode); }
|
||||
@ -154,9 +139,6 @@ public:
|
||||
inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = nullptr);
|
||||
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = nullptr);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
|
||||
#endif
|
||||
qint64 cacheKey() const;
|
||||
|
||||
bool isDetached() const;
|
||||
@ -168,11 +150,6 @@ public:
|
||||
|
||||
inline bool operator!() const { return isNull(); }
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED inline QPixmap alphaChannel() const;
|
||||
QT_DEPRECATED inline void setAlphaChannel(const QPixmap &);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
int metric(PaintDeviceMetric) const override;
|
||||
static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
|
||||
@ -222,23 +199,6 @@ inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format,
|
||||
return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), buf.size(), format, flags);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
inline QPixmap QPixmap::alphaChannel() const
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
return QPixmap::fromImage(toImage().alphaChannel());
|
||||
QT_WARNING_POP
|
||||
}
|
||||
|
||||
inline void QPixmap::setAlphaChannel(const QPixmap &p)
|
||||
{
|
||||
QImage image = toImage();
|
||||
image.setAlphaChannel(p.toImage());
|
||||
*this = QPixmap::fromImage(image);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
QPixmap stream functions
|
||||
|
@ -482,45 +482,6 @@ QPixmapCacheEntry::~QPixmapCacheEntry()
|
||||
pm_cache()->releaseKey(key);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
Use bool find(const QString &, QPixmap *) instead.
|
||||
|
||||
Returns the pixmap associated with the \a key in the cache, or
|
||||
null if there is no such pixmap.
|
||||
|
||||
\warning If valid, you should copy the pixmap immediately (this is
|
||||
fast). Subsequent insertions into the cache could cause the
|
||||
pointer to become invalid. For this reason, we recommend you use
|
||||
bool find(const QString&, QPixmap*) instead.
|
||||
|
||||
Example:
|
||||
\snippet code/src_gui_image_qpixmapcache.cpp 0
|
||||
*/
|
||||
|
||||
QPixmap *QPixmapCache::find(const QString &key)
|
||||
{
|
||||
if (!qt_pixmapcache_thread_test())
|
||||
return nullptr;
|
||||
return pm_cache()->object(key);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
Use bool find(const QString &, QPixmap *) instead.
|
||||
*/
|
||||
|
||||
bool QPixmapCache::find(const QString &key, QPixmap &pixmap)
|
||||
{
|
||||
return find(key, &pixmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Looks for a cached pixmap associated with the given \a key in the cache.
|
||||
If the pixmap is found, the function sets \a pixmap to that pixmap and
|
||||
|
@ -74,12 +74,6 @@ public:
|
||||
|
||||
static int cacheLimit();
|
||||
static void setCacheLimit(int);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
|
||||
static QPixmap *find(const QString &key);
|
||||
QT_DEPRECATED_X("Use bool find(const QString &, QPixmap *) instead")
|
||||
static bool find(const QString &key, QPixmap &pixmap);
|
||||
#endif
|
||||
static bool find(const QString &key, QPixmap *pixmap);
|
||||
static bool find(const Key &key, QPixmap *pixmap);
|
||||
static bool insert(const QString &key, const QPixmap &pixmap);
|
||||
|
@ -70,8 +70,6 @@ private slots:
|
||||
void setAlphaChannel_data();
|
||||
void setAlphaChannel();
|
||||
|
||||
void alphaChannel();
|
||||
|
||||
void convertToFormat_data();
|
||||
void convertToFormat();
|
||||
void convertToFormatWithColorTable();
|
||||
@ -544,32 +542,6 @@ void tst_QImage::setAlphaChannel()
|
||||
}
|
||||
}
|
||||
QVERIFY(allPixelsOK);
|
||||
|
||||
QImage outAlpha = image.alphaChannel();
|
||||
QCOMPARE(outAlpha.size(), image.size());
|
||||
|
||||
bool allAlphaOk = true;
|
||||
for (int y=0; y<height; ++y) {
|
||||
for (int x=0; x<width; ++x) {
|
||||
allAlphaOk &= outAlpha.pixelIndex(x, y) == alpha;
|
||||
}
|
||||
}
|
||||
QVERIFY(allAlphaOk);
|
||||
|
||||
}
|
||||
|
||||
void tst_QImage::alphaChannel()
|
||||
{
|
||||
QImage img(10, 10, QImage::Format_Mono);
|
||||
img.setColor(0, Qt::transparent);
|
||||
img.setColor(1, Qt::black);
|
||||
img.fill(0);
|
||||
|
||||
QPainter p(&img);
|
||||
p.fillRect(2, 2, 6, 6, Qt::black);
|
||||
p.end();
|
||||
|
||||
QCOMPARE(img.alphaChannel(), img.convertToFormat(QImage::Format_ARGB32).alphaChannel());
|
||||
}
|
||||
|
||||
void tst_QImage::convertToFormat_data()
|
||||
|
@ -146,13 +146,6 @@ void tst_QImageWriter::getSetCheck()
|
||||
QCOMPARE(INT_MIN, obj1.compression());
|
||||
obj1.setCompression(INT_MAX);
|
||||
QCOMPARE(INT_MAX, obj1.compression());
|
||||
|
||||
// float QImageWriter::gamma()
|
||||
// void QImageWriter::setGamma(float)
|
||||
obj1.setGamma(0.0f);
|
||||
QCOMPARE(0.0f, obj1.gamma());
|
||||
obj1.setGamma(1.1f);
|
||||
QCOMPARE(1.1f, obj1.gamma());
|
||||
}
|
||||
|
||||
void tst_QImageWriter::writeImage_data()
|
||||
|
@ -107,24 +107,15 @@ void tst_QPixmapCache::setCacheLimit()
|
||||
QPixmap res;
|
||||
QPixmap *p1 = new QPixmap(2, 3);
|
||||
QPixmapCache::insert("P1", *p1);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1") != 0);
|
||||
#endif
|
||||
QVERIFY(QPixmapCache::find("P1", &res));
|
||||
delete p1;
|
||||
|
||||
QPixmapCache::setCacheLimit(0);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(!QPixmapCache::find("P1"));
|
||||
#endif
|
||||
QVERIFY(!QPixmapCache::find("P1", &res));
|
||||
|
||||
p1 = new QPixmap(2, 3);
|
||||
QPixmapCache::setCacheLimit(1000);
|
||||
QPixmapCache::insert("P1", *p1);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1") != 0);
|
||||
#endif
|
||||
QVERIFY(QPixmapCache::find("P1", &res));
|
||||
|
||||
delete p1;
|
||||
@ -210,17 +201,6 @@ void tst_QPixmapCache::find()
|
||||
QVERIFY(QPixmapCache::insert("P1", p1));
|
||||
|
||||
QPixmap p2;
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QVERIFY(QPixmapCache::find("P1", p2));
|
||||
QCOMPARE(p2.width(), 10);
|
||||
QCOMPARE(p2.height(), 10);
|
||||
QCOMPARE(p1, p2);
|
||||
|
||||
// obsolete
|
||||
QPixmap *p3 = QPixmapCache::find("P1");
|
||||
QVERIFY(p3);
|
||||
QCOMPARE(p1, *p3);
|
||||
#endif
|
||||
|
||||
QVERIFY(QPixmapCache::find("P1", &p2));
|
||||
QCOMPARE(p2.width(), 10);
|
||||
@ -278,16 +258,6 @@ void tst_QPixmapCache::insert()
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
for (int k = 0; k < numberOfKeys; ++k) {
|
||||
if (QPixmapCache::find(QString::number(k)))
|
||||
++num;
|
||||
}
|
||||
|
||||
if (QPixmapCache::find("0"))
|
||||
++num;
|
||||
num = 0;
|
||||
#endif
|
||||
QPixmap res;
|
||||
for (int k = 0; k < numberOfKeys; ++k) {
|
||||
if (QPixmapCache::find(QString::number(k), &res))
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QProgressDialog>
|
||||
#include <QSpinBox>
|
||||
#include <QScreen>
|
||||
|
||||
#include <guitest.h>
|
||||
|
||||
@ -53,7 +54,12 @@ private slots:
|
||||
|
||||
QPixmap grabWindowContents(QWidget * widget)
|
||||
{
|
||||
return QPixmap::grabWindow(widget->winId());
|
||||
QScreen *screen = widget->window()->windowHandle()->screen();
|
||||
if (!screen) {
|
||||
qWarning() << "Grabbing pixmap failed, no QScreen for" << widget;
|
||||
return QPixmap();
|
||||
}
|
||||
return screen->grabWindow(widget->winId());
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user