尝试调整图像大小:
size_t targetWidth = funnyImage.get_width();
size_t targetHeight = funnyImage.get_height();
QString inputWidth = 400;
QString inputHeight = 900;
QImage *jpgImage = new QImage(targetWidth, targetHeight, QImage::Format_RGB32);
QImage small = jpgImage->scaled(inputWidth, inputHeight,Qt::KeepAspectRatio);
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
cpp:125:错误:没有匹配函数来调用'QImage :: scaled(QString&,QString&,Qt :: AspectRatioMode)'
解决方案:QImage small = jpgImage-> scaled(inputWidth.toUInt(),inputHeight.toUint,Qt :: KeepAspectRatio);
把它放在这里,因为精彩的反思让我思考.
ari*_*ols 13
解:
QImage small = jpgImage->scaled(inputWidth.toUInt(), inputHeight.toUint,Qt::KeepAspectRatio);
Run Code Online (Sandbox Code Playgroud)