mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
fix: get grab rect error
This commit is contained in:
parent
f2f8c462fb
commit
f0ce346406
2 changed files with 12 additions and 9 deletions
|
@ -215,18 +215,21 @@ void Device::initSignals()
|
|||
|
||||
// update ui
|
||||
if (m_videoForm) {
|
||||
// must be show before updateShowSize
|
||||
m_videoForm->show();
|
||||
|
||||
m_videoForm->setWindowTitle(deviceName);
|
||||
m_videoForm->updateShowSize(size);
|
||||
|
||||
bool deviceVer = size.height() > size.width();
|
||||
QRect rc = Config::getInstance().getRect(getSerial());
|
||||
if (rc.isValid()) {
|
||||
m_videoForm->move(rc.topLeft());
|
||||
bool rcVer = rc.height() > rc.width();
|
||||
// same width/height rate
|
||||
if (rc.isValid() && (deviceVer == rcVer)) {
|
||||
// mark: resize is for fix setGeometry magneticwidget bug
|
||||
m_videoForm->resize(rc.size());
|
||||
// TODO: setGeometry magneticwidget bug
|
||||
//m_videoForm->setGeometry(rc);
|
||||
m_videoForm->setGeometry(rc);
|
||||
}
|
||||
// videoForm delay show
|
||||
m_videoForm->show();
|
||||
}
|
||||
|
||||
// init recorder
|
||||
|
|
|
@ -88,14 +88,14 @@ QRect VideoForm::getGrabCursorRect()
|
|||
{
|
||||
QRect rc;
|
||||
#if defined(Q_OS_WIN32)
|
||||
rc = QRect(m_videoWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size());
|
||||
rc = QRect(ui->keepRadioWidget->mapToGlobal(m_videoWidget->pos()), m_videoWidget->size());
|
||||
// high dpi support
|
||||
rc.setTopLeft(rc.topLeft() * m_videoWidget->devicePixelRatio());
|
||||
rc.setBottomRight(rc.bottomRight() * m_videoWidget->devicePixelRatio());
|
||||
#elif defined(Q_OS_OSX)
|
||||
rc = m_videoWidget->geometry();
|
||||
rc.setTopLeft(m_videoWidget->mapToGlobal(rc.topLeft()));
|
||||
rc.setBottomRight(m_videoWidget->mapToGlobal(rc.bottomRight()));
|
||||
rc.setTopLeft(ui->keepRadioWidget->mapToGlobal(rc.topLeft()));
|
||||
rc.setBottomRight(ui->keepRadioWidget->mapToGlobal(rc.bottomRight()));
|
||||
rc.setX(rc.x() + 100);
|
||||
rc.setY(rc.y() + 30);
|
||||
rc.setWidth(rc.width() - 180);
|
||||
|
|
Loading…
Add table
Reference in a new issue