Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 打开相机下方概率性出现静态图 #270

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/src/videowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,15 @@

#endif

void videowidget::ReceiveMajorImage(QImage *image, int result)

Check warning on line 434 in src/src/videowidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'ReceiveMajorImage' is never used.

Check warning on line 434 in src/src/videowidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'ReceiveMajorImage' is never used.

Check warning on line 434 in src/src/videowidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'ReceiveMajorImage' is never used.

Check warning on line 434 in src/src/videowidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'ReceiveMajorImage' is never used.
{
// 若窗口高度改变,需要刷新整个窗口,防止上一帧图像出现在其它区域
static int height = this->height();
if (height != this->height()) {
update();
height = this->height();
}

if (!image->isNull()) {
switch (result) {
case 0: //Success
Expand All @@ -452,9 +459,8 @@
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);
Expand Down