本文整理汇总了Python中PyQt5.QtWidgets.QGraphicsView.resetTransform方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsView.resetTransform方法的具体用法?Python QGraphicsView.resetTransform怎么用?Python QGraphicsView.resetTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QGraphicsView
的用法示例。
在下文中一共展示了QGraphicsView.resetTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsView [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsView import resetTransform [as 别名]
#.........这里部分代码省略.........
def pointer_group_clicked(self):
self.scene.set_mode(self.pointer_type_group.checkedId())
def bring_to_front(self):
if not self.scene.selectedItems():
return
selected_item = self.scene.selectedItems()[0]
overlap_items = selected_item.collidingItems()
z_value = 0
for item in overlap_items:
if item.zValue() >= z_value and isinstance(item, FlumeDiagramItem):
z_value = item.zValue() + 0.1
selected_item.setZValue(z_value)
def send_to_back(self):
if not self.scene.selectedItems():
return
selected_item = self.scene.selectedItems()[0]
overlap_items = selected_item.collidingItems()
z_value = 0
for item in overlap_items:
if item.zValue() <= z_value and isinstance(item, FlumeDiagramItem):
z_value = item.zValue() - 0.1
selected_item.setZValue(z_value)
def scene_scale_changed(self, scale):
new_scale = float(scale[:scale.index("%")]) / 100
old_transform = self.view.transform()
self.view.resetTransform()
self.view.translate(old_transform.dx(), old_transform.dy())
self.view.scale(new_scale, new_scale)
def item_inserted(self, diagram_type):
self.pointer_type_group.button(DiagramScene.MoveItem).setChecked(True)
self.scene.set_mode(self.scene.DefaultMode)
self.button_group.button(self.clicked_button_id).setChecked(False)
def text_inserted(self, item):
self.button_group.button(self.InsertTextButton).setChecked(False)
self.scene.set_mode(self.pointer_type_group.checkedId())
def current_font_changed(self, font):
self.handle_font_change()
def font_size_changed(self, font=None):
self.handle_font_change()
def text_color_changed(self):
self.text_action = self.sender()
self.font_color_tool_button.setIcon(
self.create_color_tool_button_icon(':/images/textpointer.png',
QColor(self.text_action.data())))
self.text_button_triggered()
def item_color_changed(self):
self.fillAction = self.sender()
self.fill_color_tool_button.setIcon(
self.create_color_tool_button_icon(':/images/floodfill.png',
QColor(self.fillAction.data())))
self.fill_button_triggered()