mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-03 14:18:45 +00:00
fix: getScreenRect is empty
This commit is contained in:
parent
6eb673a2aa
commit
12f8813577
1 changed files with 7 additions and 5 deletions
|
@ -92,7 +92,7 @@ QRect VideoForm::getGrabCursorRect()
|
||||||
// high dpi support
|
// high dpi support
|
||||||
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
||||||
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
||||||
|
|
||||||
rc.setX(rc.x() + 10);
|
rc.setX(rc.x() + 10);
|
||||||
rc.setY(rc.y() + 10);
|
rc.setY(rc.y() + 10);
|
||||||
rc.setWidth(rc.width() - 20);
|
rc.setWidth(rc.width() - 20);
|
||||||
|
@ -111,7 +111,7 @@ QRect VideoForm::getGrabCursorRect()
|
||||||
// high dpi support -- taken from the WIN32 section and untested
|
// high dpi support -- taken from the WIN32 section and untested
|
||||||
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
||||||
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
||||||
|
|
||||||
rc.setX(rc.x() + 10);
|
rc.setX(rc.x() + 10);
|
||||||
rc.setY(rc.y() + 10);
|
rc.setY(rc.y() + 10);
|
||||||
rc.setWidth(rc.width() - 20);
|
rc.setWidth(rc.width() - 20);
|
||||||
|
@ -329,14 +329,16 @@ QRect VideoForm::getScreenRect()
|
||||||
if (!win) {
|
if (!win) {
|
||||||
return screenRect;
|
return screenRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindow *winHandle = win->windowHandle();
|
QWindow *winHandle = win->windowHandle();
|
||||||
if (!winHandle) {
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
return screenRect;
|
if (winHandle) {
|
||||||
|
screen = winHandle->screen();
|
||||||
}
|
}
|
||||||
QScreen *screen = winHandle->screen();
|
|
||||||
if (!screen) {
|
if (!screen) {
|
||||||
return screenRect;
|
return screenRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
screenRect = screen->availableGeometry();
|
screenRect = screen->availableGeometry();
|
||||||
return screenRect;
|
return screenRect;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue