修复屏幕比例失真的问题

This commit is contained in:
Jabin ma 2019-06-25 22:50:59 +08:00
parent 1292950aae
commit 7016d92bf8
3 changed files with 7 additions and 1 deletions

View file

@ -130,6 +130,7 @@ void Device::initSignals()
// update ui
if (m_videoForm) {
m_videoForm->setWindowTitle(deviceName);
m_videoForm->updateScreenRatio(size);
m_videoForm->updateShowSize(size);
}

View file

@ -112,11 +112,15 @@ void VideoForm::updateStyleSheet(bool vertical)
}
}
void VideoForm::updateScreenRatio(const QSize &newSize)
{
m_widthHeightRatio = 1.0f * qMin(newSize.width(),newSize.height()) / qMax(newSize.width(),newSize.height());
}
void VideoForm::updateShowSize(const QSize &newSize)
{
if (frameSize != newSize) {
frameSize = newSize;
bool vertical = newSize.height() > newSize.width();
QSize showSize = newSize;
QDesktopWidget* desktop = QApplication::desktop();

View file

@ -21,6 +21,7 @@ public:
void switchFullScreen();
void staysOnTop(bool top = true);
void updateScreenRatio(const QSize &newSize);
void updateShowSize(const QSize &newSize);
void updateRender(const AVFrame *frame);
void setController(Controller *controller);