Skip to content

Commit

Permalink
🎈 perf: 时钟树拖拽缩放性能优化
Browse files Browse the repository at this point in the history
Signed-off-by: xqyjlj <xqyjlj@126.com>
  • Loading branch information
xqyjlj committed Jan 20, 2025
1 parent cebc7f3 commit 3190d3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions view/clock_tree_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
from PySide6.QtGui import QColor, QPixmap, Qt, QPainter
from PySide6.QtSvg import QSvgRenderer
from PySide6.QtSvgWidgets import QGraphicsSvgItem
from PySide6.QtWidgets import (QWidget, QGraphicsScene, QGraphicsPixmapItem, QGraphicsProxyWidget, QGraphicsItem,
QButtonGroup)
from PySide6.QtWidgets import (QWidget, QGraphicsScene, QGraphicsPixmapItem, QGraphicsProxyWidget, QButtonGroup)
from qfluentwidgets import isDarkTheme, BodyLabel

from common import Icon, SETTINGS, PROJECT, Style, SUMMARY, IP, CLOCK_TREE
Expand Down Expand Up @@ -173,7 +172,7 @@ def __addWidget(self):
# w.setProperty('config', element)
proxy = QGraphicsProxyWidget()
proxy.setWidget(widget)
proxy.setCacheMode(QGraphicsItem.CacheMode.ItemCoordinateCache, size)
# proxy.setCacheMode(QGraphicsItem.CacheMode.ItemCoordinateCache, size)
proxy.setPos(geom.x * self.__multiple, geom.y * self.__multiple)
if z >= 0:
proxy.setZValue(z)
Expand Down
6 changes: 3 additions & 3 deletions widget/graphics_view_pan_zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def __init__(self, parent=None):
QPainter.RenderHint.TextAntialiasing |
QPainter.RenderHint.SmoothPixmapTransform)
self.viewport().setCursor(Qt.CursorShape.ArrowCursor)
INT_MAX = 2147483647
INT_MIN = -2147483648
self.setSceneRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX)
# INT_MAX = 2147483647
# INT_MIN = -2147483648
# self.setSceneRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX)

def setupMatrix(self):
scale = math.pow(2, (self.scale - (self.MIN_SCALE + self.MAX_SCALE) / 2) / self.RESOLUTION)
Expand Down

0 comments on commit 3190d3a

Please sign in to comment.