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


Python QKeySequence.fromString方法代码示例

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


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

示例1: importShortcut

# 需要导入模块: from PyQt4.QtGui import QKeySequence [as 别名]
# 或者: from PyQt4.QtGui.QKeySequence import fromString [as 别名]
def importShortcut(filename, widget, schemeWidget):
    """Loads shortcuts from a file"""
    try:
        d = ET.parse(filename)
        root = d.getroot()
        if root.tag != 'frescobaldi-shortcut':
            raise ValueError(_("No shortcuts found."))
    except Exception as e:
        QMessageBox.critical(widget, app.caption(_("Error")),
        _("Can't read from source:\n\n{url}\n\n{error}").format(
            url=filename, error=e))
        return
    
    schemeWidget.scheme.blockSignals(True)
    scheme = schemeWidget.addScheme(root.get('name'))
    schemeWidget.scheme.blockSignals(False)
    
    for col in root.findall('collection'):
        for name in col.findall('name'):
            shortcuts = [QKeySequence.fromString(shortcut.text) for shortcut in name.findall('shortcut')]
            item = widget.item(col.attrib['name'], name.attrib['name'])
            if item:
                item.setShortcuts(shortcuts, scheme)
            
    schemeWidget.disableDefault(False)
    schemeWidget.currentChanged.emit()
    schemeWidget.changed.emit()
开发者ID:uliska,项目名称:frescobaldi,代码行数:29,代码来源:import_export.py

示例2: filter

# 需要导入模块: from PyQt4.QtGui import QKeySequence [as 别名]
# 或者: from PyQt4.QtGui.QKeySequence import fromString [as 别名]
    def filter(self, filterString: str, item: QTreeWidgetItem) -> bool:
        visible = (filterString == "")
        columnCount = item.columnCount()
        for i in range(columnCount):
            if not visible:
                break
            text = item.text(i)
            if HostOsInfo.isMacHost():
                # accept e.g. Cmd+E in the filter. the text shows special fancy characters for Cmd
                if i == columnCount - 1:
                    key = QKeySequence.fromString(text, QKeySequence.NativeText)
                    if not key.isEmpty():
                        text = key.toString(QKeySequence.PortableText)
                        text.replace("Ctrl", "Cmd")
                        text.replace("Meta", "Ctrl")
                        text.replace("Alt", "Opt")

            if filterString.upper() in text.upper(): # case insensitive
                visible = True

        childCount = item.childCount()
        if childCount > 0:
        # force visibility if this item matches
            leafFilterString = "" if visible else filterString
            for i in range(childCount):
                citem = item.child(i) # QTreeWidgetItem
                if not filter(leafFilterString, citem):
                    visible = True

        item.setHidden(not visible)
        return not visible
开发者ID:nerdocs,项目名称:MedUX,代码行数:33,代码来源:__init__.py

示例3: shortcut

# 需要导入模块: from PyQt4.QtGui import QKeySequence [as 别名]
# 或者: from PyQt4.QtGui.QKeySequence import fromString [as 别名]
 def shortcut(self):
     return QKeySequence.fromString(self.text())
开发者ID:adjustive,项目名称:enki,代码行数:4,代码来源:action_shortcut_editor.py


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