From 20b2726f5fbe05dba8ac72a312aa257d52b12df6 Mon Sep 17 00:00:00 2001 From: fengli Date: Wed, 8 Nov 2023 14:55:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=93=E5=BC=80=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E4=B8=8B=E6=96=B9=E6=A6=82=E7=8E=87=E6=80=A7=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E9=9D=99=E6=80=81=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复打开相机时下方概率性出现静态图像的问题 Log: 修复打开相机时下方概率性出现静态图像的问题 Bug: https://pms.uniontech.com/bug-view-227191.html --- src/src/videowidget.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/src/videowidget.cpp b/src/src/videowidget.cpp index 8759d42e..d65a3c76 100644 --- a/src/src/videowidget.cpp +++ b/src/src/videowidget.cpp @@ -433,6 +433,13 @@ void videowidget::ReceiveOpenGLstatus(bool result) void videowidget::ReceiveMajorImage(QImage *image, int result) { + // 若窗口高度改变,需要刷新整个窗口,防止上一帧图像出现在其它区域 + static int height = this->height(); + if (height != this->height()) { + update(); + height = this->height(); + } + if (!image->isNull()) { switch (result) { case 0: //Success @@ -452,9 +459,8 @@ void videowidget::ReceiveMajorImage(QImage *image, int result) if (m_openglwidget && m_openglwidget->isVisible()) m_openglwidget->hide(); { - // OpenGL窗口等比例缩放画面 - int widgetwidth = width(); - int widgetheight = height(); + int widgetwidth = this->width(); + int widgetheight = this->height(); if ((image->width() * 100 / image->height()) > (widgetwidth * 100 / widgetheight)) { QImage img = image->scaled(widgetwidth, widgetwidth * image->height() / image->width(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); m_framePixmap = QPixmap::fromImage(img);