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