Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决Windows屏幕比例不为100%时的问题 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
解决向上和向左时的问题
Rackar committed Aug 17, 2024

Unverified

This user has not yet uploaded their public signing key.
commit 8bc1dc899b84b0edbd9b6364421b6f9052694c41
12 changes: 6 additions & 6 deletions mapItem.py
Original file line number Diff line number Diff line change
@@ -60,9 +60,9 @@ def updateImageRect(self, x, y):
self.line = QLineF(0, y, w, y)
elif self.direction == 1: # 1:'⬆'
self.x = 0
self.y = y*scaling_factor
self.y = y
self.w = w
self.h = h - y*scaling_factor
self.h = h - y
self.line = QLineF(0, y, w, y)
elif self.direction == 2: # 2:'➡'
self.x = 0
@@ -71,9 +71,9 @@ def updateImageRect(self, x, y):
self.h = h
self.line = QLineF(x, 0, x, h)
else: # 3:'⬅'
self.x = x*scaling_factor
self.x = x
self.y = 0
self.w = w - x*scaling_factor
self.w = w - x
self.h = h
self.line = QLineF(x, 0, x, h)
self.startPaint = True
@@ -90,7 +90,7 @@ def paint(self, painter, *args):
if self.line:
painter.drawLine(self.line)

image = self.image.copy(int(self.x), int(
self.y), int(self.w), int(self.h))
image = self.image.copy(int(self.x*scaling_factor), int(
self.y*scaling_factor), int(self.w), int(self.h))
painter.drawImage(QRectF(self.x,
self.y, self.w/scaling_factor, self.h/scaling_factor), image)