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


Python QtCore.QPoint方法代码示例

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


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

示例1: getSelectedNodesCentroid

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def getSelectedNodesCentroid(self):
        selectedNodes = self.getSelectedNodes()

        leftMostNode = None
        topMostNode = None
        for node in selectedNodes:
            nodePos = node.getGraphPos()

            if leftMostNode is None:
                leftMostNode = node
            else:
                if nodePos.x() < leftMostNode.getGraphPos().x():
                    leftMostNode = node

            if topMostNode is None:
                topMostNode = node
            else:
                if nodePos.y() < topMostNode.getGraphPos().y():
                    topMostNode = node

        xPos = leftMostNode.getGraphPos().x()
        yPos = topMostNode.getGraphPos().y()
        pos = QtCore.QPoint(xPos, yPos)

        return pos 
开发者ID:EricTRocks,项目名称:pyflowgraph,代码行数:27,代码来源:graph_view.py

示例2: test_contextMenuEvent_calls_exec

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def test_contextMenuEvent_calls_exec(view_and_model, monkeypatch):
    # test that a menu is displayed when clicking on an item
    mock_exec = Mock()
    monkeypatch.setattr('spyder_unittest.widgets.datatree.QMenu.exec_', mock_exec)
    view, model = view_and_model
    pos = view.visualRect(model.index(0, 0)).center()
    event = QContextMenuEvent(QContextMenuEvent.Mouse, pos)
    view.contextMenuEvent(event)
    assert mock_exec.called

    # test that no menu is displayed when clicking below the bottom item
    mock_exec.reset_mock()
    pos = view.visualRect(model.index(1, 0)).bottomRight()
    pos += QPoint(0, 1)
    event = QContextMenuEvent(QContextMenuEvent.Mouse, pos)
    view.contextMenuEvent(event)
    assert not mock_exec.called 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:19,代码来源:test_datatree.py

示例3: canvas_context_menu

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def canvas_context_menu(self, point: QPoint) -> None:
        """MainCanvas context menu."""
        index = self.entities_tab.currentIndex()
        if index == 0:
            self.__enable_point_context()
            self.action_c_add_target.setVisible(
                self.main_panel.currentWidget() is self.synthesis_tab
                and self.synthesis_tab_widget.currentWidget() is self.dimensional_synthesis
                and self.dimensional_synthesis.has_target()
            )
            self.pop_canvas_p.exec_(self.main_canvas.mapToGlobal(point))
            self.action_new_link.setVisible(True)
            self.pop_point_m.clear()
        elif index == 1:
            self.__enable_link_context()
            self.pop_canvas_l.exec_(self.main_canvas.mapToGlobal(point))
            self.pop_link_m.clear() 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:19,代码来源:actions.py

示例4: H

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def H(self, repeat=1):
        """Move cursor to the top of the page"""
        editor = self._widget.editor()
        position = editor.cursorForPosition(QPoint(0, 0)).position()
        self._set_cursor(position, mode=QTextCursor.MoveAnchor) 
开发者ID:spyder-ide,项目名称:spyder-vim,代码行数:7,代码来源:vim_widget.py

示例5: L

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def L(self, repeat=1):
        """Move cursor to the bottom of the page"""
        editor = self._widget.editor()
        position = editor.cursorForPosition(QPoint(0, editor.viewport().height())).position()
        self._set_cursor(position, mode=QTextCursor.MoveAnchor) 
开发者ID:spyder-ide,项目名称:spyder-vim,代码行数:7,代码来源:vim_widget.py

示例6: M

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def M(self, repeat=1):
        """Move cursor to the middle of the page"""
        editor = self._widget.editor()
        position = editor.cursorForPosition(QPoint(0, int((editor.viewport().height())*0.5))).position()
        self._set_cursor(position, mode=QTextCursor.MoveAnchor) 
开发者ID:spyder-ide,项目名称:spyder-vim,代码行数:7,代码来源:vim_widget.py

示例7: test_H_command

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def test_H_command(vim_bot):
    """Test H command (Cursor moves to the top of the screen)."""
    main, editor_stack, editor, vim, qtbot = vim_bot
    editor.resize(400, 800)
    editor.stdkey_backspace()
    cmd_line = vim.get_focus_widget()
    qtbot.keyClicks(cmd_line, 'ggVGy')
    qtbot.keyClicks(cmd_line, '100pG')
    first_position = editor.cursorForPosition(QPoint(0,0)).position()
    qtbot.keyClicks(cmd_line, 'H')
    position = editor.textCursor().position()
    assert first_position == position 
开发者ID:spyder-ide,项目名称:spyder-vim,代码行数:14,代码来源:test_vim.py

示例8: test_L_command

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def test_L_command(vim_bot):
    """Test L command (Cursor moves to the bottom of the screen)."""
    main, editor_stack, editor, vim, qtbot = vim_bot
    editor.resize(400, 800)
    editor.stdkey_backspace()
    cmd_line = vim.get_focus_widget()
    qtbot.keyClicks(cmd_line, 'ggVGy')
    qtbot.keyClicks(cmd_line, '100pgg')
    first_position = editor.cursorForPosition(QPoint(0, editor.viewport().height())).position()
    qtbot.keyClicks(cmd_line, 'L')
    position = editor.textCursor().position()
    assert first_position == position 
开发者ID:spyder-ide,项目名称:spyder-vim,代码行数:14,代码来源:test_vim.py

示例9: update_position

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def update_position(self):
        """Update slider position."""
        x = self.get_pos() - self.width() // 2
        y = self.slider.handle_radius + 12
        self.move(QPoint(x, -y) + self.slider.pos()) 
开发者ID:napari,项目名称:napari,代码行数:7,代码来源:qt_range_slider_popup.py

示例10: show_above_mouse

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def show_above_mouse(self, *args):
        """Show popup dialog above the mouse cursor position."""
        pos = QCursor().pos()  # mouse position
        szhint = self.sizeHint()
        pos -= QPoint(szhint.width() / 2, szhint.height() + 14)
        self.move(pos)
        self.show() 
开发者ID:napari,项目名称:napari,代码行数:9,代码来源:qt_modal.py

示例11: show_right_of_mouse

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def show_right_of_mouse(self, *args):
        pos = QCursor().pos()  # mouse position
        szhint = self.sizeHint()
        pos -= QPoint(-14, szhint.height() / 4)
        self.move(pos)
        self.show() 
开发者ID:napari,项目名称:napari,代码行数:8,代码来源:qt_modal.py

示例12: test_modified_scrollbar_click

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def test_modified_scrollbar_click(qtbot):
    w = ModifiedScrollBar(Qt.Horizontal)
    w.resize(100, 10)
    assert w.value() == 0
    qtbot.mousePress(w, Qt.LeftButton, pos=QPoint(50, 5))
    # the normal QScrollBar would have moved to "10"
    assert w.value() >= 40 
开发者ID:napari,项目名称:napari,代码行数:9,代码来源:test_qt_scrollbar.py

示例13: pixmap

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def pixmap(self, size, mode, state):
        pm = QPixmap(size)
        pm.fill(Qt.transparent)
        self.paint(QPainter(pm), QRect(QPoint(0, 0), size), mode, state)
        return pm 
开发者ID:spyder-ide,项目名称:qtawesome,代码行数:7,代码来源:iconic_font.py

示例14: point_context_menu

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def point_context_menu(self, point: QPoint) -> None:
        """EntitiesPoint context menu."""
        self.__enable_point_context()
        self.pop_point.exec_(self.entities_point_widget.mapToGlobal(point))
        self.action_new_link.setVisible(True)
        self.pop_point_m.clear() 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:8,代码来源:actions.py

示例15: link_context_menu

# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import QPoint [as 别名]
def link_context_menu(self, point: QPoint) -> None:
        """EntitiesLink context menu."""
        self.__enable_link_context()
        self.pop_link.exec_(self.entities_link_widget.mapToGlobal(point))
        self.pop_link_m.clear() 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:7,代码来源:actions.py


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