Merge pull request #6516 from jonaski/sizeinbytes

Use QImage::sizeInBytes() with Qt 5.10 and above
This commit is contained in:
John Maguire 2020-01-06 00:12:02 +00:00 committed by GitHub
commit 008c90ff29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -66,7 +66,11 @@ QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
int channels = i.isGrayscale() ? 1 : (i.hasAlphaChannel() ? 4 : 3);
arg << i.depth() / channels;
arg << channels;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
arg << QByteArray(reinterpret_cast<const char*>(i.bits()), i.sizeInBytes());
#else
arg << QByteArray(reinterpret_cast<const char*>(i.bits()), i.byteCount());
#endif
arg.endStructure();
return arg;
}