本文整理匯總了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)