本文整理汇总了Python中Qt.QtCore.Slot方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.Slot方法的具体用法?Python QtCore.Slot怎么用?Python QtCore.Slot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qt.QtCore
的用法示例。
在下文中一共展示了QtCore.Slot方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: currentTabChanged
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def currentTabChanged(self, idx):
""" Slot called when the current tab has changed.
:Parameters:
idx : `int`
Index of the newly selected tab
"""
prevMode = self.currTab.inEditMode
self.currTab = self.tabWidget.widget(idx)
if prevMode != self.currTab.inEditMode:
self.editModeChanged.emit(self.currTab.inEditMode)
self.setNavigationMenus()
self.updateButtons()
if not self.quitting:
# Highlighting can be very slow on bigger files. Don't worry about
# updating it if we're closing tabs while quitting the app.
self.findHighlightAll()
示例2: customTextEditorContextMenu
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [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
示例3: customTextBrowserContextMenu
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [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
示例4: customTabWidgetContextMenu
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [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
示例5: commentTextRequest
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def commentTextRequest(self):
""" Slot called by the Comment action. """
self.currTab.getCurrentTextWidget().commentOutText(*self.getCommentStrings())
示例6: uncommentTextRequest
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def uncommentTextRequest(self):
""" Slot called by the Uncomment action. """
self.currTab.getCurrentTextWidget().uncommentText(*self.getCommentStrings())
示例7: onBreadcrumbActivated
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def onBreadcrumbActivated(self, path):
""" Slot called when a breadcrumb link (history for the current tab) is selected.
:Parameters:
path : `str`
Breadcrumb path
"""
# Check if there are any changes to be saved before we modify the history.
if not self.dirtySave():
return
self.currTab.gotoBreadcrumb(path)
示例8: onBreadcrumbHovered
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def onBreadcrumbHovered(self, path):
""" Slot called when the mouse is hovering over a breadcrumb link.
"""
self.statusbar.showMessage(path, 2000)
示例9: onActionTriggered
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import Slot [as 别名]
def onActionTriggered(self, *args):
""" Slot called when an action for the tab is activated
(i.e. a tab from the Recently Closed Tabs menu).
"""
if self.isActive:
self.changeTab.emit(self)
else:
self.restoreTab.emit(self)