There's no QVector anymore, QList is the QVector in Qt6

This commit is contained in:
Laurent Montel 2023-10-20 07:10:28 +02:00
parent 524711f633
commit 7864ad4bc6
8 changed files with 25 additions and 25 deletions

View File

@ -383,7 +383,7 @@ bool ANIHandler::ensureScanned() const
// TODO should we check that the number of rate entries matches nSteps? // TODO should we check that the number of rate entries matches nSteps?
auto *dataPtr = data.data(); auto *dataPtr = data.data();
QVector<int> list; QList<int> list;
for (int i = 0; i < data.size(); i += sizeof(quint32_le)) { for (int i = 0; i < data.size(); i += sizeof(quint32_le)) {
const auto entry = *(reinterpret_cast<const quint32_le *>(dataPtr + i)); const auto entry = *(reinterpret_cast<const quint32_le *>(dataPtr + i));
list.append(entry); list.append(entry);

View File

@ -41,14 +41,14 @@ private:
int m_frameCount = 0; // "physical" frames int m_frameCount = 0; // "physical" frames
int m_imageCount = 0; // logical images int m_imageCount = 0; // logical images
// Stores a custom sequence of images // Stores a custom sequence of images
QVector<int> m_imageSequence; QList<int> m_imageSequence;
// and the corresponding offsets where they are // and the corresponding offsets where they are
// since we can't read the image data sequentally in this case then // since we can't read the image data sequentally in this case then
QVector<qint64> m_frameOffsets; QList<qint64> m_frameOffsets;
qint64 m_firstFrameOffset = 0; qint64 m_firstFrameOffset = 0;
int m_displayRate = 0; int m_displayRate = 0;
QVector<int> m_displayRates; QList<int> m_displayRates;
QString m_name; QString m_name;
QString m_artist; QString m_artist;

View File

@ -14,8 +14,8 @@
#include <QImage> #include <QImage>
#include <QImageIOHandler> #include <QImageIOHandler>
#include <QImageIOPlugin> #include <QImageIOPlugin>
#include <QList>
#include <QVariant> #include <QVariant>
#include <QVector>
#include <jxl/decode.h> #include <jxl/decode.h>
@ -71,7 +71,7 @@ private:
void *m_runner; void *m_runner;
JxlBasicInfo m_basicinfo; JxlBasicInfo m_basicinfo;
QVector<int> m_framedelays; QList<int> m_framedelays;
int m_next_image_delay; int m_next_image_delay;
QImage m_current_image; QImage m_current_image;

View File

@ -126,7 +126,7 @@ struct PSDDuotoneOptions {
*/ */
struct PSDColorModeDataSection { struct PSDColorModeDataSection {
PSDDuotoneOptions duotone; PSDDuotoneOptions duotone;
QVector<QRgb> palette; QList<QRgb> palette;
}; };
using PSDImageResourceSection = QHash<quint16, PSDImageResourceBlock>; using PSDImageResourceSection = QHash<quint16, PSDImageResourceBlock>;
@ -458,7 +458,7 @@ PSDColorModeDataSection readColorModeDataSection(QDataStream &s, bool *ok = null
} }
else { // read the palette (768 bytes) else { // read the palette (768 bytes)
auto&& palette = cms.palette; auto&& palette = cms.palette;
QVector<quint8> vect(size); QList<quint8> vect(size);
for (auto&& v : vect) for (auto&& v : vect)
s >> v; s >> v;
for (qsizetype i = 0, n = vect.size()/3; i < n; ++i) for (qsizetype i = 0, n = vect.size()/3; i < n; ++i)
@ -1109,7 +1109,7 @@ static bool LoadPSD(QDataStream &stream, const PSDHeader &header, QImage &img)
return false; return false;
} }
QVector<quint32> strides(header.height * header.channel_count, raw_count); QList<quint32> strides(header.height * header.channel_count, raw_count);
// Read the compressed stride sizes // Read the compressed stride sizes
if (compression) { if (compression) {
for (auto&& v : strides) { for (auto&& v : strides) {
@ -1124,7 +1124,7 @@ static bool LoadPSD(QDataStream &stream, const PSDHeader &header, QImage &img)
} }
// calculate the absolute file positions of each stride (required when a colorspace conversion should be done) // calculate the absolute file positions of each stride (required when a colorspace conversion should be done)
auto device = stream.device(); auto device = stream.device();
QVector<quint64> stridePositions(strides.size()); QList<quint64> stridePositions(strides.size());
if (!stridePositions.isEmpty()) { if (!stridePositions.isEmpty()) {
stridePositions[0] = device->pos(); stridePositions[0] = device->pos();
} }

View File

@ -221,7 +221,7 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
// Read palette if needed. // Read palette if needed.
if (ras.ColorMapType == RAS_COLOR_MAP_TYPE_RGB) { if (ras.ColorMapType == RAS_COLOR_MAP_TYPE_RGB) {
QVector<quint8> palette(ras.ColorMapLength); QList<quint8> palette(ras.ColorMapLength);
for (quint32 i = 0; i < ras.ColorMapLength; ++i) { for (quint32 i = 0; i < ras.ColorMapLength; ++i) {
s >> palette[i]; s >> palette[i];
} }

View File

@ -22,13 +22,13 @@
#include "rgb_p.h" #include "rgb_p.h"
#include "util_p.h" #include "util_p.h"
#include <QList>
#include <QMap> #include <QMap>
#include <QVector>
#include <QDebug> #include <QDebug>
#include <QImage> #include <QImage>
class RLEData : public QVector<uchar> class RLEData : public QList<uchar>
{ {
public: public:
RLEData() RLEData()
@ -61,7 +61,7 @@ public:
{ {
} }
uint insert(const uchar *d, uint l); uint insert(const uchar *d, uint l);
QVector<const RLEData *> vector(); QList<const RLEData *> vector();
void setBaseOffset(uint o) void setBaseOffset(uint o)
{ {
_offset = o; _offset = o;
@ -107,7 +107,7 @@ private:
QByteArray _data; QByteArray _data;
QByteArray::Iterator _pos; QByteArray::Iterator _pos;
RLEMap _rlemap; RLEMap _rlemap;
QVector<const RLEData *> _rlevector; QList<const RLEData *> _rlevector;
uint _numrows; uint _numrows;
bool readData(QImage &); bool readData(QImage &);
@ -421,9 +421,9 @@ uint RLEMap::insert(const uchar *d, uint l)
return QMap<RLEData, uint>::insert(data, _counter++).value(); return QMap<RLEData, uint>::insert(data, _counter++).value();
} }
QVector<const RLEData *> RLEMap::vector() QList<const RLEData *> RLEMap::vector()
{ {
QVector<const RLEData *> v(size()); QList<const RLEData *> v(size());
for (Iterator it = begin(); it != end(); ++it) { for (Iterator it = begin(); it != end(); ++it) {
v.replace(it.value(), &it.key()); v.replace(it.value(), &it.key());
} }

View File

@ -13,7 +13,7 @@
#include <QImage> #include <QImage>
#include <QImageIOHandler> #include <QImageIOHandler>
// QVector uses some extra space for stuff, hence the 32 here suggested by Thiago Macieira // QList uses some extra space for stuff, hence the 32 here suggested by Thiago Macieira
static constexpr int kMaxQVectorSize = std::numeric_limits<int>::max() - 32; static constexpr int kMaxQVectorSize = std::numeric_limits<int>::max() - 32;
// On Qt 6 to make the plugins fail to allocate if the image size is greater than QImageReader::allocationLimit() // On Qt 6 to make the plugins fail to allocate if the image size is greater than QImageReader::allocationLimit()

View File

@ -14,10 +14,10 @@
#include <QIODevice> #include <QIODevice>
#include <QImage> #include <QImage>
#include <QImageReader> #include <QImageReader>
#include <QList>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QPainter> #include <QPainter>
#include <QStack> #include <QStack>
#include <QVector>
#include <QtEndian> #include <QtEndian>
#ifndef XCF_QT5_SUPPORT #ifndef XCF_QT5_SUPPORT
@ -110,7 +110,7 @@ struct RandomTable {
* parallel processing on a tile-by-tile basis. Here, though, * parallel processing on a tile-by-tile basis. Here, though,
* we just read them in en-masse and store them in a matrix. * we just read them in en-masse and store them in a matrix.
*/ */
typedef QVector<QVector<QImage>> Tiles; typedef QList<QList<QImage>> Tiles;
class XCFImageFormat class XCFImageFormat
{ {
@ -492,7 +492,7 @@ public:
qint32 tattoo; //!< (unique identifier?) qint32 tattoo; //!< (unique identifier?)
quint32 unit; //!< Units of The GIMP (inch, mm, pica, etc...) quint32 unit; //!< Units of The GIMP (inch, mm, pica, etc...)
qint32 num_colors = 0; //!< number of colors in an indexed image qint32 num_colors = 0; //!< number of colors in an indexed image
QVector<QRgb> palette; //!< indexed image color palette QList<QRgb> palette; //!< indexed image color palette
int num_layers; //!< number of layers int num_layers; //!< number of layers
Layer layer; //!< most recently read layer Layer layer; //!< most recently read layer
@ -545,7 +545,7 @@ private:
//! This table is used as a shared grayscale ramp to be set on grayscale //! This table is used as a shared grayscale ramp to be set on grayscale
//! images. This is because Qt does not differentiate between indexed and //! images. This is because Qt does not differentiate between indexed and
//! grayscale images. //! grayscale images.
static QVector<QRgb> grayTable; static QList<QRgb> grayTable;
//! This table provides the add_pixel saturation values (i.e. 250 + 250 = 255). //! This table provides the add_pixel saturation values (i.e. 250 + 250 = 255).
// static int add_lut[256][256]; - this is so lame waste of 256k of memory // static int add_lut[256][256]; - this is so lame waste of 256k of memory
@ -646,7 +646,7 @@ bool XCFImageFormat::random_table_initialized;
constexpr RandomTable XCFImageFormat::randomTable; constexpr RandomTable XCFImageFormat::randomTable;
QVector<QRgb> XCFImageFormat::grayTable; QList<QRgb> XCFImageFormat::grayTable;
bool XCFImageFormat::modeAffectsSourceAlpha(const quint32 type) bool XCFImageFormat::modeAffectsSourceAlpha(const quint32 type)
{ {
@ -993,7 +993,7 @@ bool XCFImageFormat::loadImageProperties(QDataStream &xcf_io, XCFImage &xcf_imag
return false; return false;
} }
xcf_image.palette = QVector<QRgb>(); xcf_image.palette = QList<QRgb>();
xcf_image.palette.reserve(xcf_image.num_colors); xcf_image.palette.reserve(xcf_image.num_colors);
for (int i = 0; i < xcf_image.num_colors; i++) { for (int i = 0; i < xcf_image.num_colors; i++) {
@ -2013,7 +2013,7 @@ bool XCFImageFormat::loadLevel(QDataStream &xcf_io, Layer &layer, qint32 bpp, co
const uint blockSize = TILE_WIDTH * TILE_HEIGHT * bpp * 1.5; const uint blockSize = TILE_WIDTH * TILE_HEIGHT * bpp * 1.5;
QVector<uchar> buffer; QList<uchar> buffer;
if (needConvert) { if (needConvert) {
buffer.resize(blockSize * (bpp == 2 ? 2 : 1)); buffer.resize(blockSize * (bpp == 2 ? 2 : 1));
} }