mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 19:30:26 +08:00
fix: #716
This commit is contained in:
parent
6fac6616b6
commit
7b9197eea1
@ -39,6 +39,7 @@ QImage ScreenShotWindow::DoScreenShot()
|
|||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
//
|
//
|
||||||
desktopImage = qApp->screenAt(QCursor::pos())->grabWindow(0);
|
desktopImage = qApp->screenAt(QCursor::pos())->grabWindow(0);
|
||||||
|
scale = qApp->screenAt(QCursor::pos())->devicePixelRatio();
|
||||||
//
|
//
|
||||||
int w = desktopImage.width();
|
int w = desktopImage.width();
|
||||||
int h = desktopImage.height();
|
int h = desktopImage.height();
|
||||||
@ -58,7 +59,7 @@ QImage ScreenShotWindow::DoScreenShot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setStyleSheet("QDialog { background-color: transparent; }");
|
setStyleSheet("QDialog { background-color: transparent; }");
|
||||||
bg_grey = bg_grey.scaled(bg_grey.size() / devicePixelRatio(), Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
bg_grey = bg_grey.scaled(bg_grey.size() / scale, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
||||||
auto p = this->palette();
|
auto p = this->palette();
|
||||||
p.setBrush(QPalette::Window, bg_grey);
|
p.setBrush(QPalette::Window, bg_grey);
|
||||||
setPalette(p);
|
setPalette(p);
|
||||||
@ -78,8 +79,7 @@ void ScreenShotWindow::pSize()
|
|||||||
imgY = origin.y() < end.y() ? origin.y() : end.y();
|
imgY = origin.y() < end.y() ? origin.y() : end.y();
|
||||||
rubber.setGeometry(imgX, imgY, imgW, imgH);
|
rubber.setGeometry(imgX, imgY, imgW, imgH);
|
||||||
fg->setGeometry(rubber.geometry());
|
fg->setGeometry(rubber.geometry());
|
||||||
fg->setPixmap(desktopImage.copy(fg->x() * devicePixelRatio(), fg->y() * devicePixelRatio(), fg->width() * devicePixelRatio(),
|
fg->setPixmap(desktopImage.copy(imgX * scale, imgY * scale, imgW * scale, imgH * scale));
|
||||||
fg->height() * devicePixelRatio()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenShotWindow::event(QEvent *e)
|
bool ScreenShotWindow::event(QEvent *e)
|
||||||
|
@ -34,6 +34,7 @@ class ScreenShotWindow
|
|||||||
void on_startBtn_clicked();
|
void on_startBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
double scale;
|
||||||
QRubberBand rubber;
|
QRubberBand rubber;
|
||||||
// Desktop Image
|
// Desktop Image
|
||||||
QPixmap desktopImage;
|
QPixmap desktopImage;
|
||||||
|
Loading…
Reference in New Issue
Block a user