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


Python QtCore.QPoint方法代码示例

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


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

示例1: mousePressEvent

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def mousePressEvent(self, evnt):
        super(TesterList, self).mousePressEvent(evnt)

        if QtCore.Qt.MouseButton.LeftButton == evnt.button():
            index = self.indexAt(evnt.pos())
            if index.row() < 0:
                self.__current_tester = None
                self.clearSelection()

        elif QtCore.Qt.MouseButton.RightButton == evnt.button():
            menu = QtWidgets.QMenu(self)
            test = QtWidgets.QAction("Single Test", menu)
            menu.addAction(test)
            pos = self.mapToGlobal(evnt.pos())
            menu.popup(QtCore.QPoint(pos.x() - 10, pos.y() - 10))
            test.triggered.connect(self.__testTriggered) 
开发者ID:sol-ansano-kim,项目名称:medic,代码行数:18,代码来源:widgets.py

示例2: computeDisplayPoints

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def computeDisplayPoints(self, nonLinearRes=50):
        items = self.sortedItems()
        points = []
        if len(items):
            for item in items:
                points.append(item.scenePos() - self.mapToScene(QtCore.QPoint(-1.5, -1.5)))

            if self.bezier:
                bezierPoints = []
                numSteps = nonLinearRes
                for k in range(numSteps):
                    t = float(k) / (numSteps - 1)
                    x = int(self._rawRamp.interpolateBezier([p.x() for p in points], 0, len(items) - 1, t))
                    y = int(self._rawRamp.interpolateBezier([p.y() for p in points], 0, len(items) - 1, t))
                    bezierPoints.append(QtCore.QPointF(x, y))
                points = bezierPoints
            points = self.getCornerPoints(0) + points + self.getCornerPoints(1)
        self.displayPoints = points 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:20,代码来源:QtSliders.py

示例3: customTextBrowserContextMenu

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def customTextBrowserContextMenu(self, pos):
        """ Slot for the right-click context menu when in Browse mode.
        
        :Parameters:
            pos : `QtCore.QPoint`
                Position of the right-click
        """
        menu = self.currTab.textBrowser.createStandardContextMenu()
        actions = menu.actions()
        # Right now, you may see the open in new tab action even if you aren't
        # hovering over a link. Ideally, because of imperfection with the hovering
        # signal, we would check if the cursor is hovering over a link here.
        if self.linkHighlighted.toString():
            menu.insertAction(actions[0], self.actionOpenLinkNewWindow)
            menu.insertAction(actions[0], self.actionOpenLinkNewTab)
            menu.insertAction(actions[0], self.actionOpenLinkWith)
            menu.insertSeparator(actions[0])
            menu.addAction(self.actionSaveLinkAs)
        else:
            menu.insertAction(actions[0], self.actionBack)
            menu.insertAction(actions[0], self.actionForward)
            menu.insertAction(actions[0], self.actionRefresh)
            menu.insertAction(actions[0], self.actionStop)
            menu.insertSeparator(actions[0])
            menu.addAction(self.actionSaveAs)
            path = self.currTab.getCurrentPath()
            if path:
                menu.addSeparator()
                if utils.isUsdFile(path):
                    menu.addAction(self.actionUsdView)
                menu.addAction(self.actionTextEditor)
                menu.addAction(self.actionOpenWith)
                menu.addSeparator()
                menu.addAction(self.actionFileInfo)
                menu.addAction(self.actionViewSource)
        actions[0].setIcon(self.actionCopy.icon())
        actions[3].setIcon(self.actionSelectAll.icon())
        menu.exec_(self.currTab.textBrowser.mapToGlobal(pos))
        del actions, menu 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:41,代码来源:__init__.py

示例4: customTextEditorContextMenu

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def customTextEditorContextMenu(self, pos):
        """ Slot for the right-click context menu when in Edit mode.
        
        :Parameters:
            pos : `QtCore.QPoint`
                Position of the right-click
        """
        # Add icons to standard context menu.
        menu = self.currTab.textEditor.createStandardContextMenu()
        actions = menu.actions()
        actions[0].setIcon(self.actionUndo.icon())
        actions[1].setIcon(self.actionRedo.icon())
        actions[3].setIcon(self.actionCut.icon())
        actions[4].setIcon(self.actionCopy.icon())
        actions[5].setIcon(self.actionPaste.icon())
        actions[6].setIcon(QtGui.QIcon.fromTheme("edit-delete"))
        actions[8].setIcon(self.actionSelectAll.icon())
        path = self.currTab.getCurrentPath()
        if path:
            menu.addSeparator()
            if utils.isUsdFile(path):
                menu.addAction(self.actionUsdView)
            menu.addAction(self.actionTextEditor)
            menu.addAction(self.actionOpenWith)
            menu.addSeparator()
            menu.addAction(self.actionFileInfo)
        menu.exec_(self.currTab.textEditor.mapToGlobal(pos))
        del actions, menu 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:30,代码来源:__init__.py

示例5: customTabWidgetContextMenu

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def customTabWidgetContextMenu(self, pos):
        """ Slot for the right-click context menu for the tab widget.
        
        :Parameters:
            pos : `QtCore.QPoint`
                Position of the right-click
        """
        menu = QtWidgets.QMenu(self)
        menu.addAction(self.actionNewTab)
        menu.addSeparator()
        menu.addAction(self.actionRefreshTab)
        menu.addAction(self.actionDuplicateTab)
        menu.addSeparator()
        menu.addAction(self.actionCloseTab)
        menu.addAction(self.actionCloseOther)
        menu.addAction(self.actionCloseRight)
        
        self.contextMenuPos = self.tabWidget.tabBar.mapFromParent(pos)
        indexOfClickedTab = self.tabWidget.tabBar.tabAt(self.contextMenuPos)
        if indexOfClickedTab == -1:
            self.actionCloseTab.setEnabled(False)
            self.actionCloseOther.setEnabled(False)
            self.actionCloseRight.setEnabled(False)
            self.actionRefreshTab.setEnabled(False)
            self.actionDuplicateTab.setEnabled(False)
        else:
            self.actionCloseTab.setEnabled(True)
            self.actionCloseOther.setEnabled(self.tabWidget.count() > 1)
            self.actionCloseRight.setEnabled(indexOfClickedTab < self.tabWidget.count() - 1)
            self.actionRefreshTab.setEnabled(bool(self.tabWidget.widget(indexOfClickedTab).getCurrentPath()))
            self.actionDuplicateTab.setEnabled(True)
        
        menu.exec_(self.tabWidget.mapToGlobal(pos))
        del menu
        self.contextMenuPos = None 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:37,代码来源:__init__.py

示例6: __init__

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def __init__(self, parent=None):
        """ Create and initialize the tab bar.
        
        :Parameters:
            parent : `TabWidget`
                Main container of the tab bar and individual tabs
        """
        super(TabBar, self).__init__(parent)
        self.setAcceptDrops(True)
        self.dragStartPos = QtCore.QPoint() 
开发者ID:dreamworksanimation,项目名称:usdmanager,代码行数:12,代码来源:__init__.py

示例7: _update

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def _update(self):
        """Update internal properties

        """
        # Update path
        self._shape = QtGui.QPainterPath()
        poly = QtGui.QPolygonF([
            self._source_pos,
            QtCore.QPointF(self._mouse_pos.x(), self._source_pos.y()),
            self._mouse_pos,
            QtCore.QPoint(self._source_pos.x(), self._mouse_pos.y())
        ])
        self._shape.addPolygon(poly)
        self._shape.closeSubpath() 
开发者ID:dsideb,项目名称:nodegraph-pyqt,代码行数:16,代码来源:rubberband.py

示例8: _update_line

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def _update_line(self):
        """Re-implement function that updates edge line definition

        """
        start = QtCore.QPoint(0, 0)
        if self._source_slot.family & NodeSlot.OUTPUT:
            end = self._mouse_pos - self._source_slot.center
        else:
            end = self._source_slot.center - self._mouse_pos

        self._line = QtCore.QLineF(start, end) 
开发者ID:dsideb,项目名称:nodegraph-pyqt,代码行数:13,代码来源:edge.py

示例9: mousePressEvent

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def mousePressEvent(self, event):
        self.prevValue = self.value()
        self.startDragpos = event.pos()
        if event.button() == QtCore.Qt.MidButton:
            if self.draggers is None:
                self.draggers = draggers(self, self.isFloat, draggerSteps=self.draggerSteps)
                self.draggers.increment.connect(self.valueIncremented.emit)
            self.draggers.show()
            if self.isFloat:
                self.draggers.move(self.mapToGlobal(QtCore.QPoint(event.pos().x() - 1, event.pos().y() - self.draggers.height() / 2)))
            else:
                self.draggers.move(self.mapToGlobal(QtCore.QPoint(event.pos().x() - 1, event.pos().y() - (self.draggers.height() - self.draggers.height() / 6))))

        elif event.button() == self.LeftButton and event.modifiers() not in [QtCore.Qt.ControlModifier, QtCore.Qt.ShiftModifier, QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier]:
            butts = QtCore.Qt.MouseButtons(self.MidButton)
            nevent = QtGui.QMouseEvent(event.type(), event.pos(),
                                       self.MidButton, butts,
                                       event.modifiers())
            super(slider, self).mousePressEvent(nevent)

        elif event.modifiers() in [QtCore.Qt.ControlModifier, QtCore.Qt.ShiftModifier, QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier]:
            st_slider = QtWidgets.QStyleOptionSlider()
            st_slider.initFrom(self)
            st_slider.orientation = self.orientation()
            available = self.style().pixelMetric(QtWidgets.QStyle.PM_SliderSpaceAvailable, st_slider, self)
            xloc = QtWidgets.QStyle.sliderPositionFromValue(self.minimum(), self.maximum(), super(slider, self).value(), available)
            butts = QtCore.Qt.MouseButtons(self.MidButton)
            newPos = QtCore.QPointF()
            newPos.setX(xloc)
            nevent = QtGui.QMouseEvent(event.type(), newPos,
                                       self.MidButton, butts,
                                       event.modifiers())
            self.startDragpos = newPos
            self.realStartDragpos = event.pos()
            super(slider, self).mousePressEvent(nevent)
            self.deltaValue = self.value() - self.prevValue
            self.setValue(self.prevValue)
        else:
            super(slider, self).mousePressEvent(event) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:41,代码来源:QtSliders.py

示例10: eventFilter

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def eventFilter(self, object, event):
        if event.type() == QtCore.QEvent.MouseButtonPress:
            if event.button() == QtCore.Qt.MiddleButton:
                if self.draggers is None:
                    self.draggers = draggers(self, self.isFloat, draggerSteps=self.draggerSteps)
                    self.draggers.increment.connect(self.onValueIncremented)
                self.draggers.show()
                if self.isFloat:
                    self.draggers.move(self.mapToGlobal(QtCore.QPoint(event.pos().x() - 1, event.pos().y() - self.draggers.height() / 2)))
                else:
                    self.draggers.move(self.mapToGlobal(QtCore.QPoint(event.pos().x() - 1, event.pos().y() - self.draggers.height() + 15)))
        return False 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:14,代码来源:QtSliders.py

示例11: getCornerPoints

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def getCornerPoints(self, corner=0):
        if corner == 0:
            return [QtCore.QPointF(self.itemSize / 2, self.frameSize().height() - self.itemSize / 2),
                    QtCore.QPointF(self.itemSize / 2, self.sortedItems()[0].scenePos().y() - self.mapToScene(QtCore.QPoint(-1.5, -1.5)).y())]
        else:
            return [QtCore.QPointF(self.frameSize().width() - self.itemSize / 2, self.sortedItems()[-1].scenePos().y() - self.mapToScene(QtCore.QPoint(-1.5, -1.5)).y()),
                    QtCore.QPointF(self.frameSize().width() - self.itemSize / 2, self.frameSize().height() - self.itemSize / 2)] 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:9,代码来源:QtSliders.py

示例12: drawBackground

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def drawBackground(self, painter, rect):
        painter.fillRect(rect.adjusted(self.itemSize / 2, self.itemSize / 2, -self.itemSize / 2, -self.itemSize / 2), editableStyleSheet().InputFieldColor)
        painter.setBrush(QtGui.QColor(0, 0, 0, 0))
        painter.setPen(QtGui.QColor(0, 0, 0, 255))
        painter.drawRect(rect.adjusted(self.itemSize / 2, self.itemSize / 2, -self.itemSize / 2, -self.itemSize / 2))
        items = self.sortedItems()
        val = self.mapToScene(QtCore.QPoint(-1.5, -1.5))
        if len(items):
            painter.setBrush(QtGui.QColor(100, 100, 100))
            painter.drawPolygon(self.displayPoints, QtCore.Qt.WindingFill)
        else:
            b = editableStyleSheet().InputFieldColor 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:14,代码来源:QtSliders.py

示例13: findPinNearPosition

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def findPinNearPosition(self, scenePos, tolerance=3):
        tolerance = tolerance * self.currentViewScale()
        rect = QtCore.QRect(QtCore.QPoint(scenePos.x() - tolerance, scenePos.y() - tolerance),
                            QtCore.QPoint(scenePos.x() + tolerance, scenePos.y() + tolerance))
        items = self.items(rect)
        pins = [i for i in items if isinstance(i, UIPinBase) and type(i) is not PinGroup]
        if len(pins) > 0:
            return pins[0]
        return None 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:11,代码来源:BlueprintCanvas.py

示例14: dragMoveEvent

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def dragMoveEvent(self, event):
        self.mousePos = event.pos()
        scenePos = self.mapToScene(self.mousePos)
        if self.dropCallback is not None:
            event.accept()
        elif event.mimeData().hasFormat('text/plain'):
            event.setDropAction(QtCore.Qt.MoveAction)
            event.accept()
            if self.tempnode:
                self.tempnode.setPos((self.tempnode.w / -2) + scenePos.x(), scenePos.y())
                mouseRect = QtCore.QRect(QtCore.QPoint(scenePos.x() - 1, scenePos.y() - 1),
                                         QtCore.QPoint(scenePos.x() + 1, scenePos.y() + 1))
                hoverItems = self.scene().items(mouseRect)
                for item in hoverItems:
                    if isinstance(item, UIConnection):
                        valid = False
                        for inp in self.tempnode.UIinputs.values():
                            if canConnectPins(item.source()._rawPin, inp._rawPin):
                                valid = True
                        for out in self.tempnode.UIoutputs.values():
                            if canConnectPins(out._rawPin, item.destination()._rawPin):
                                valid = True
                        if valid:
                            self.hoverItems.append(item)
                            item.drawThick()
                for item in self.hoverItems:
                    if item not in hoverItems:
                        self.hoverItems.remove(item)
                        if isinstance(item, UIConnection):
                            item.restoreThick()
                    else:
                        if isinstance(item, UIConnection):
                            item.drawThick()
        else:
            super(BlueprintCanvas, self).dragMoveEvent(event) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:37,代码来源:BlueprintCanvas.py

示例15: updateCurve

# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QPoint [as 别名]
def updateCurve(self, p1, p2):
        xDistance = p2.x() - p1.x()
        multiply = 3
        self.mPath = QtGui.QPainterPath()

        self.mPath.moveTo(p1)
        if xDistance < 0:
            self.mPath.cubicTo(QtCore.QPoint(p1.x() + xDistance / -multiply, p1.y()),
                               QtCore.QPoint(p2.x() - xDistance / -multiply, p2.y()), p2)
        else:
            self.mPath.cubicTo(QtCore.QPoint(p1.x() + xDistance / multiply,
                                             p1.y()), QtCore.QPoint(p2.x() - xDistance / 2, p2.y()), p2)

        self.setPath(self.mPath) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:16,代码来源:UIConnection.py


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