本文整理汇总了Python中qtpy.QtCore.Slot方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.Slot方法的具体用法?Python QtCore.Slot怎么用?Python QtCore.Slot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtCore
的用法示例。
在下文中一共展示了QtCore.Slot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __enable_point_context
# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import Slot [as 别名]
def __enable_point_context(self) -> None:
"""Adjust the status of QActions.
What ever we have least one point or not,
need to enable / disable QAction.
"""
selection = self.entities_point.selected_rows()
# Set grounded state
if selection:
self.action_p_lock.setChecked(all(
VLink.FRAME in self.vpoint_list[row].links for row in selection
))
self.context.point_enable(len(selection))
def mj_func(order: int) -> Callable[[], None]:
"""Generate a merge function."""
@Slot()
def func() -> None:
self.__to_multiple_joint(order, selection)
return func
for i, p in enumerate(selection):
action = QAction(f"Base on Point{p}", self)
action.triggered.connect(mj_func(i))
self.pop_point_m.addAction(action)
示例2: __enable_link_context
# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import Slot [as 别名]
def __enable_link_context(self) -> None:
"""Enable / disable link's QAction, same as point table."""
selection = self.entities_link.selected_rows()
row = self.entities_link.currentRow()
self.context.link_enable(len(selection), row)
def ml_func(order: int) -> Callable[[], None]:
"""Generate a merge function."""
@Slot(int)
def func() -> None:
self.__merge_link(order, selection)
return func
for i, row in enumerate(selection):
action = QAction(f"Base on \"{self.vlink_list[row].name}\"", self)
action.triggered.connect(ml_func(i))
self.pop_link_m.addAction(action)
示例3: __alignment
# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import Slot [as 别名]
def __alignment(self) -> None:
"""Menu of alignment function."""
def switch_icon(m: int, icon_name: str) -> Callable[[], None]:
@Slot()
def func() -> None:
self.alignment_mode = m
self.alignment_button.setIcon(QIcon(QPixmap(icon_name)))
return func
menu = QMenu(self)
for i, (text, icon) in enumerate([
("Vertical alignment", "vertical_align"),
("Horizontal alignment", "horizontal_align"),
]):
icon = f":/icons/{icon}.png"
action = QAction(QIcon(QPixmap(icon)), text, self)
action.triggered.connect(switch_icon(i, icon))
menu.addAction(action)
self.alignment_button.setMenu(menu)
self.alignment_button.clicked.connect(self.point_alignment)
示例4: __init__
# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import Slot [as 别名]
def __init__(self, row: int, parent: QWidget):
super(BaseTableWidget, self).__init__(parent)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setStatusTip("This table will show about the entities items in "
"current view mode.")
self.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.setSelectionBehavior(QAbstractItemView.SelectRows)
self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
self.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
self.setRowCount(row)
self.setColumnCount(len(self.headers))
for i, e in enumerate(self.headers):
self.setHorizontalHeaderItem(i, QTableWidgetItem(e))
# Table widget column width.
header = self.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeToContents)
@Slot()
def emit_selection_changed() -> None:
self.row_selection_changed.emit(self.selected_rows())
self.itemSelectionChanged.connect(emit_selection_changed)
示例5: __free_move
# 需要导入模块: from qtpy import QtCore [as 别名]
# 或者: from qtpy.QtCore import Slot [as 别名]
def __free_move(self) -> None:
"""Menu of free move mode."""
def free_move_mode_func(j: int, icon_qt: QIcon) -> Callable[[], None]:
@Slot()
def func() -> None:
self.free_move_button.setIcon(icon_qt)
self.main_canvas.set_free_move(j)
self.entities_tab.setCurrentIndex(0)
self.inputs_widget.variable_stop.click()
return func
menu = QMenu(self)
for i, (text, icon, tip) in enumerate([
("View mode", "free_move_off", "Disable free move mode."),
("Translate mode", "translate", "Edit by 2 DOF moving."),
("Rotate mode", "rotate", "Edit by 1 DOF moving."),
("Reflect mode", "reflect", "Edit by flip axis."),
]):
action = QAction(QIcon(QPixmap(f":/icons/{icon}.png")), text, self)
action.triggered.connect(free_move_mode_func(i, action.icon()))
action.setShortcut(f"Ctrl+{i + 1}")
action.setShortcutContext(Qt.WindowShortcut)
action.setStatusTip(tip)
menu.addAction(action)
if i == 0:
self.free_move_disable = action
self.free_move_button.setMenu(menu)