当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QGraphicsView方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QGraphicsView方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QGraphicsView方法的具体用法?Python QtWidgets.QGraphicsView怎么用?Python QtWidgets.QGraphicsView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QGraphicsView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self):
        super().__init__()
        self.show()
        self.setMinimumHeight(300)

        self.ib_qtimer = None
        self.ob_qtimer = None
        self.updating_gui_bool = False
        self.new_cycle_bool = True

        self.in_breath_graphics_qgri_list = []
        self.out_breath_graphics_qgri_list = []

        vbox_l2 = QtWidgets.QVBoxLayout()
        self.setLayout(vbox_l2)

        # vbox_l2.addWidget(QtWidgets.QLabel("Breathing History"))
        self.breathing_graphicsview = QtWidgets.QGraphicsView()  # QGraphicsScene
        vbox_l2.addWidget(self.breathing_graphicsview)
        self.breathing_graphicsscene = QtWidgets.QGraphicsScene()
        self.breathing_graphicsview.setScene(self.breathing_graphicsscene)
        # self.breathing_graphicsview.centerOn(QtCore.Qt.AlignRight)
        # alignment can be set with "setAlignment"
        self.breathing_graphicsview.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag) 
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:26,代码来源:breathing_history_wt.py

示例2: mouseMoveEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def mouseMoveEvent(self, event):
        # Compare mouse positions
        # This allows to filter out scrolling
        # from a normal mouseEvent
        QtWidgets.QGraphicsView.mouseMoveEvent(self, event)
        if not self.mousePosition:
            self.mousePosition = event.pos()
            return

        current_position = event.pos()
        if current_position == self.mousePosition or self.parent.sideDock.isVisible():
            return
        else:
            self.mousePosition = event.pos()

            self.parent.navBar.show()
            if QtWidgets.QApplication.mouseButtons() == QtCore.Qt.NoButton:
                self.viewport().setCursor(QtCore.Qt.OpenHandCursor)
            else:
                self.viewport().setCursor(QtCore.Qt.ClosedHandCursor)
            self.parent.mouseHideTimer.start(2000) 
开发者ID:BasioMeusPuga,项目名称:Lector,代码行数:23,代码来源:contentwidgets.py

示例3: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self):
        super().__init__()

        self.setObjectName('map-view')
        self.scene = QtWidgets.QGraphicsScene()
        self.setScene(self.scene)
        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setTransformationAnchor(QtWidgets.QGraphicsView.NoAnchor)
        self.setResizeAnchor(QtWidgets.QGraphicsView.NoAnchor)
        self.setMouseTracking(True)
        self.current_column = -1
        self.current_row = -1

        # TODO hardcore tile size somewhere else (and a bit less hard)
        self.TILE_SIZE = 80 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:18,代码来源:editor.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, plugin):
        """
        Initialize the Overview.
        :type plugin: Overview
        """
        super().__init__(plugin.parent())
        self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
        self.setMinimumSize(QtCore.QSize(216, 216))
        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setOptimizationFlags(QtWidgets.QGraphicsView.DontAdjustForAntialiasing)
        self.setOptimizationFlags(QtWidgets.QGraphicsView.DontSavePainterState)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setViewportUpdateMode(QtWidgets.QGraphicsView.NoViewportUpdate)
        self._mousePressed = False
        self._view = None

    #############################################
    #   PROPERTIES
    ################################# 
开发者ID:danielepantaleone,项目名称:eddy,代码行数:21,代码来源:overview.py

示例5: ok

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def ok(self):

        self.gridLayoutWidget = QtWidgets.QWidget()
        self.gridLayoutWidget.setGeometry(QtCore.QRect(180, 10, 1100, 500))  # 定义gridLayout控件的大小和位置,4个数字分别为左边坐标,上边坐标,长,宽
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget)  
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)  # 在gridLayoutWidget 上创建一个网格Layout,注意以gridLayoutWidget为参
        self.gridLayout_2.setObjectName("gridLayout_2")
        
        # ===通过graphicview来显示图形
        self.graphicview = QtWidgets.QGraphicsView(self.gridLayoutWidget)  # 第一步,创建一个QGraphicsView,注意同样以gridLayoutWidget为参
        self.graphicview.setObjectName("graphicview")
        self.gridLayout_2.addWidget(self.graphicview, 0, 0)  #第二步,将该QGraphicsView放入Layout中

        dr = Figure_Canvas() #实例化一个FigureCanvas
        dr.test()  # 画图
        graphicscene = QtWidgets.QGraphicsScene()  # 第三步,创建一个QGraphicsScene,因为加载的图形(FigureCanvas)不能直接放到graphicview控件中,必须先放到graphicScene,然后再把graphicscene放到graphicview中
        graphicscene.addWidget(dr)  # 第四步,把图形放到QGraphicsScene中,注意:图形是作为一个QWidget放到QGraphicsScene中的
        self.graphicview.setScene(graphicscene) # 第五步,把QGraphicsScene放入QGraphicsView
        self.graphicview.show()  # 最后,调用show方法呈现图形!Voila!! 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:22,代码来源:Test.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, *args):
		super(SymbolView, self).__init__(*args)
		from UIManager import UIManager
		self.setScene(UIManager.instance().getSymbolScene())


		self.setViewportUpdateMode(QtWidgets.QGraphicsView.FullViewportUpdate)
		self.setCacheMode(QtWidgets.QGraphicsView.CacheNone)
		#self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
		self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
		self.setMouseTracking(True)
		self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
		self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
		self.setAcceptDrops(True)
		self.setViewport(QtOpenGL.QGLWidget())

		self.centerPnt = QtCore.QPointF()
		self.scale(0.6,0.6)

		self.mousePressPnt = None
		self.mouseCurPnt = None
		self.isFrameSelectMode = False 
开发者ID:league1991,项目名称:CodeAtlasSublime,代码行数:24,代码来源:symbolview.py

示例7: blurPixmap

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def blurPixmap(pixmap, radius):
    effect = QGraphicsBlurEffect()
    effect.setBlurRadius(radius)
    buffer = QPixmap(pixmap)
    item = QGraphicsPixmapItem(buffer)
    item.setGraphicsEffect(effect)
    output = QPixmap(pixmap.width(), pixmap.height())
    painter = QtGui.QPainter(output)
    scene = QtWidgets.QGraphicsScene()
    view = QtWidgets.QGraphicsView(scene)
    scene.addItem(item)
    scene.render(painter)
    return output 
开发者ID:xsyann,项目名称:detection,代码行数:15,代码来源:common.py

示例8: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, *args, **kwargs):
        """
        Set the transformation anchor to below the current mouse position.
        """
        super().__init__(*args, **kwargs)
        self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:8,代码来源:qt.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, conf, defeat):
        self.config = conf
        super().__init__()
        self.setWindowTitle(conf.get_text('victory'))
        self.setFixedSize(QSize(640, 480))
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.WindowTitleHint | Qt.FramelessWindowHint)
        button = QPushButton(conf.get_text('close'), self)
        button.setCheckable(True)
        button.setFixedSize(QSize(640, 30))
        button.move(0, 450)
        # noinspection PyUnresolvedReferences
        button.clicked.connect(self.close)
        result_output = QTextEdit(self)
        result_output.setReadOnly(True)
        result_output.setFixedSize(QSize(640, 200))
        result_output.move(0, 250)
        result_output.setLineWrapMode(QTextEdit.NoWrap)
        result_output.insertHtml(self.generate_result_text())
        gview = QGraphicsView(self)
        scene = QGraphicsScene()
        if defeat:
            img = conf.theme_selected.get_defeat_pixmap()
            text = conf.get_text('defeat')
        else:
            img = conf.theme_selected.get_victory_pixmap()
            text = conf.get_text('victory')
        scene.addPixmap(img.scaled(QSize(640, 220)))
        gview.move(0, 30)
        gview.setScene(scene)
        label_title = QLabel(self)
        label_title.setText(text)
        label_title.setFixedSize(QSize(640, 30))
        label_title.setAlignment(Qt.AlignCenter)
        label_title.setFont(self.get_font_title()) 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:36,代码来源:landBattleResultView.py

示例10: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, PFD=True, parent=None):
        super(GraphicsView, self).__init__(parent)
        self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
        self.setRenderHint(QtGui.QPainter.Antialiasing)
        self.setRenderHint(QtGui.QPainter.TextAntialiasing)
        self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor("#aaaaaa"), QtCore.Qt.Dense7Pattern))
        self.setMouseTracking(True)
        # self.setAcceptDrops(True)
        self.PFD = PFD

    #    def wheelEvent(self, event):
    #        print event.delta()
    #
    #        factor = 1.41 ** (-event.delta() / 240.0)
    #        self.zoom(factor) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:17,代码来源:flujo.py

示例11: mouseMoveEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def mouseMoveEvent(self, event):
        QtWidgets.QGraphicsView.mouseMoveEvent(self, event)
        self.mouseMove.emit(event.globalPos()) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:5,代码来源:flujo.py

示例12: mousePressEvent

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def mousePressEvent(self, event):
        QtWidgets.QGraphicsView.mousePressEvent(self, event)
        if not self.PFD:
            self.scene().views()[0].centerOn(self.mapToScene(event.pos())) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:6,代码来源:flujo.py

示例13: scaleView

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def scaleView(self, zoom):
        """
        Scale the view according to the given zoom.
        :type zoom: float
        """
        self.setTransformationAnchor(QtWidgets.QGraphicsView.NoAnchor)
        self.setResizeAnchor(QtWidgets.QGraphicsView.NoAnchor)
        self.resetTransform()
        self.translate(self.transform().dx(), self.transform().dy())
        self.scale(zoom, zoom)
        self.sgnScaled.emit(zoom)
        self.zoom = zoom 
开发者ID:danielepantaleone,项目名称:eddy,代码行数:14,代码来源:view.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self, parent=None):
        super(Activeview, self).__init__(parent)
        # self.setStyleSheet("border: 0px")
        self.selfhandle = False
        self.left = 1
        # self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
        # self.setResizeAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
        # self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorViewCenter)
        # self.setResizeAnchor(QtWidgets.QGraphicsView.AnchorViewCenter)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag) #
        self.setMinimumSize(500, 500)

        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        self.setBackgroundBrush(brush)
        #self.setAutoFillBackground(True)

        self.zoomdata = 1
        self.movelist = []
        self.movelist.append(0)
        self.movelist.append(0)

    # def updateCanvas(self, data):
    #     self.__dyCanvas = data
    #
    # def getCanvas(self):
    #     return self.__dyCanvas 
开发者ID:thomaskuestner,项目名称:CNNArt,代码行数:31,代码来源:activeview.py

示例15: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QGraphicsView [as 别名]
def __init__(self):
        super().__init__()
        self.mainscene = Scene(self)
        self.view = QtWidgets.QGraphicsView(self.mainscene)
        self.view.setRenderHint(QtGui.QPainter.Antialiasing)
        self.setCentralWidget(self.view)
        self.statusBar().showMessage(
            "Ready. Sequences loaded from " + BaseSequencesFile + "."
        ) 
开发者ID:jungmannlab,项目名称:picasso,代码行数:11,代码来源:design.py


注:本文中的PyQt5.QtWidgets.QGraphicsView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。