本文整理汇总了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
示例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
示例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()
示例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)
示例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)
示例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)
示例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
示例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
示例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())
示例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()
示例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()
示例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
示例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
示例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()
示例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()