Merge pull request #2 from jabin-ma/master

屏幕比例写死导致某些手机显示比例不正常
This commit is contained in:
Barry 2019-07-12 10:06:58 +08:00 committed by GitHub
commit dc3645c61a
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);