mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-21 20:15:04 +00:00
parent
941d0a5682
commit
8e0f656d65
2 changed files with 17 additions and 6 deletions
|
@ -100,7 +100,6 @@ void VideoForm::updateStyleSheet(bool vertical)
|
|||
border-width: 150px 142px 85px 142px;
|
||||
}
|
||||
)");
|
||||
layout()->setContentsMargins(10, 68, 12, 62);
|
||||
} else {
|
||||
setStyleSheet(R"(
|
||||
#videoForm {
|
||||
|
@ -108,8 +107,19 @@ void VideoForm::updateStyleSheet(bool vertical)
|
|||
border-width: 142px 85px 142px 150px;
|
||||
}
|
||||
)");
|
||||
layout()->setContentsMargins(68, 12, 62, 10);
|
||||
}
|
||||
layout()->setContentsMargins(getMargins(vertical));
|
||||
}
|
||||
|
||||
QMargins VideoForm::getMargins(bool vertical)
|
||||
{
|
||||
QMargins margins;
|
||||
if (vertical) {
|
||||
margins = QMargins(10, 68, 12, 62);
|
||||
} else {
|
||||
margins = QMargins(68, 12, 62, 10);
|
||||
}
|
||||
return margins;
|
||||
}
|
||||
|
||||
void VideoForm::updateScreenRatio(const QSize &newSize)
|
||||
|
@ -119,8 +129,8 @@ void VideoForm::updateScreenRatio(const QSize &newSize)
|
|||
|
||||
void VideoForm::updateShowSize(const QSize &newSize)
|
||||
{
|
||||
if (frameSize != newSize) {
|
||||
frameSize = newSize;
|
||||
if (m_frameSize != newSize) {
|
||||
m_frameSize = newSize;
|
||||
bool vertical = newSize.height() > newSize.width();
|
||||
QSize showSize = newSize;
|
||||
QDesktopWidget* desktop = QApplication::desktop();
|
||||
|
@ -138,7 +148,7 @@ void VideoForm::updateShowSize(const QSize &newSize)
|
|||
switchFullScreen();
|
||||
}
|
||||
if (layout()) {
|
||||
QMargins m = layout()->contentsMargins();
|
||||
QMargins m = getMargins(vertical);
|
||||
showSize.setWidth(showSize.width() + m.left() + m.right());
|
||||
showSize.setHeight(showSize.height() + m.top() + m.bottom());
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public slots:
|
|||
|
||||
private:
|
||||
void updateStyleSheet(bool vertical);
|
||||
QMargins getMargins(bool vertical);
|
||||
void initUI();
|
||||
|
||||
void showToolForm(bool show = true);
|
||||
|
@ -61,7 +62,7 @@ private:
|
|||
QPointer<QWidget> m_loadingWidget;
|
||||
|
||||
//inside member
|
||||
QSize frameSize;
|
||||
QSize m_frameSize;
|
||||
QPoint m_dragPosition;
|
||||
float m_widthHeightRatio = 0.5f;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue