mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-02 13:58:37 +00:00
修复屏幕比例失真的问题
This commit is contained in:
parent
dd1a857fe3
commit
4afb0dd951
3 changed files with 7 additions and 1 deletions
|
@ -130,6 +130,7 @@ void Device::initSignals()
|
||||||
// update ui
|
// update ui
|
||||||
if (m_videoForm) {
|
if (m_videoForm) {
|
||||||
m_videoForm->setWindowTitle(deviceName);
|
m_videoForm->setWindowTitle(deviceName);
|
||||||
|
m_videoForm->updateScreenRatio(size);
|
||||||
m_videoForm->updateShowSize(size);
|
m_videoForm->updateShowSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
void VideoForm::updateShowSize(const QSize &newSize)
|
||||||
{
|
{
|
||||||
if (frameSize != newSize) {
|
if (frameSize != newSize) {
|
||||||
frameSize = newSize;
|
frameSize = newSize;
|
||||||
|
|
||||||
bool vertical = newSize.height() > newSize.width();
|
bool vertical = newSize.height() > newSize.width();
|
||||||
QSize showSize = newSize;
|
QSize showSize = newSize;
|
||||||
QDesktopWidget* desktop = QApplication::desktop();
|
QDesktopWidget* desktop = QApplication::desktop();
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
|
|
||||||
void switchFullScreen();
|
void switchFullScreen();
|
||||||
void staysOnTop(bool top = true);
|
void staysOnTop(bool top = true);
|
||||||
|
void updateScreenRatio(const QSize &newSize);
|
||||||
void updateShowSize(const QSize &newSize);
|
void updateShowSize(const QSize &newSize);
|
||||||
void updateRender(const AVFrame *frame);
|
void updateRender(const AVFrame *frame);
|
||||||
void setController(Controller *controller);
|
void setController(Controller *controller);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue