本文整理汇总了Python中PyQt5.QtWidgets.QGraphicsView.setSceneRect方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsView.setSceneRect方法的具体用法?Python QGraphicsView.setSceneRect怎么用?Python QGraphicsView.setSceneRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QGraphicsView
的用法示例。
在下文中一共展示了QGraphicsView.setSceneRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: actionPrintSlot
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsView [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsView import setSceneRect [as 别名]
def actionPrintSlot(self) -> None:
printer = QPrinter()
printer.setPageOrientation(QPageLayout.Landscape)
if QPrintDialog(printer).exec_():
painter = QPainter(printer)
painter.setRenderHint(QPainter.Antialiasing)
view = QGraphicsView()
view.setScene(self.scene)
view.setSceneRect(QRectF(0, 0, 290, 200))
view.fitInView(QRectF(0, 0, 290, 200), Qt.KeepAspectRatio)
view.scale(1, -1)
view.render(painter)
del painter # necessary, thanks Qt
示例2: CarlaPatchbayW
# 需要导入模块: from PyQt5.QtWidgets import QGraphicsView [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsView import setSceneRect [as 别名]
#.........这里部分代码省略.........
self.fPeaksOut.displayMeter(1, 0.0, True)
self.fPeaksOut.displayMeter(2, 0.0, True)
def setupCanvas(self):
pOptions = patchcanvas.options_t()
pOptions.theme_name = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_THEME]
pOptions.auto_hide_groups = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS]
pOptions.use_bezier_lines = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_USE_BEZIER_LINES]
pOptions.antialiasing = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_ANTIALIASING]
pOptions.eyecandy = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_EYE_CANDY]
pFeatures = patchcanvas.features_t()
pFeatures.group_info = False
pFeatures.group_rename = False
pFeatures.port_info = False
pFeatures.port_rename = False
pFeatures.handle_group_pos = True
patchcanvas.setOptions(pOptions)
patchcanvas.setFeatures(pFeatures)
patchcanvas.init("Carla2", self.scene, canvasCallback, False)
tryCanvasSize = self.fParent.fSavedSettings[CARLA_KEY_CANVAS_SIZE].split("x")
if len(tryCanvasSize) == 2 and tryCanvasSize[0].isdigit() and tryCanvasSize[1].isdigit():
self.fCanvasWidth = int(tryCanvasSize[0])
self.fCanvasHeight = int(tryCanvasSize[1])
else:
self.fCanvasWidth = CARLA_DEFAULT_CANVAS_SIZE_WIDTH
self.fCanvasHeight = CARLA_DEFAULT_CANVAS_SIZE_HEIGHT
patchcanvas.setCanvasSize(0, 0, self.fCanvasWidth, self.fCanvasHeight)
patchcanvas.setInitialPos(self.fCanvasWidth / 2, self.fCanvasHeight / 2)
self.fView.setSceneRect(0, 0, self.fCanvasWidth, self.fCanvasHeight)
self.themeData = [self.fCanvasWidth, self.fCanvasHeight, patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()]
def updateCanvasInitialPos(self):
x = self.fView.horizontalScrollBar().value() + self.width()/4
y = self.fView.verticalScrollBar().value() + self.height()/4
patchcanvas.setInitialPos(x, y)
# -----------------------------------------------------------------
@pyqtSlot(bool)
def slot_showCanvasMeters(self, yesNo):
self.fPeaksIn.setVisible(yesNo)
self.fPeaksOut.setVisible(yesNo)
@pyqtSlot(bool)
def slot_showCanvasKeyboard(self, yesNo):
self.fKeys.setVisible(yesNo)
# -----------------------------------------------------------------
@pyqtSlot()
def slot_miniCanvasCheckAll(self):
self.slot_miniCanvasCheckSize()
self.slot_horizontalScrollBarChanged(self.fView.horizontalScrollBar().value())
self.slot_verticalScrollBarChanged(self.fView.verticalScrollBar().value())
@pyqtSlot()
def slot_miniCanvasCheckSize(self):
self.fMiniCanvasPreview.setViewSize(float(self.width()) / self.fCanvasWidth, float(self.height()) / self.fCanvasHeight)
@pyqtSlot(int)