Merge pull request #2835

a078705 QrScanThread: use sizeInBytes to fix warning (selsta)
This commit is contained in:
luigi1111 2020-04-17 20:52:33 -05:00
commit 8a73fd241e
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
1 changed files with 4 additions and 0 deletions

View File

@ -80,7 +80,11 @@ bool QrScanThread::zimageFromQImage(const QImage &qimg, zbar::Image &dst)
unsigned int bpl( qimg.bytesPerLine() ), width( bpl / 4), height( qimg.height());
dst.set_size(width, height);
dst.set_format("BGR4");
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
unsigned long datalen = qimg.sizeInBytes();
#else
unsigned long datalen = qimg.byteCount();
#endif
dst.set_data(qimg.bits(), datalen);
if((width * 4 != bpl) || (width * height * 4 > datalen)){
emit notifyError(QString("QImage to Zbar::Image failed !"));