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


Python QGuiApplication.keyboardModifiers方法代码示例

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


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

示例1: handleCursorPositionChanged

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import keyboardModifiers [as 别名]
    def handleCursorPositionChanged(self):
        cursor = self.textCursor()

        # update block format toolbar
        blockFmt = cursor.blockFormat()
        blockStyle = blockFmt.property(QTextFormat.UserProperty)
        self.updateBlockFormat.emit(blockStyle)

        # update text format toolbar
        charFmt = cursor.charFormat()   # get the QTextCharFormat at the current cursor position
        charStyle = charFmt.property(QTextFormat.UserProperty)
        self.updateCharFormat.emit(charStyle)

        # open/close URL editor for external links
        if charStyle and charStyle[0] == 'link':
            if not (QGuiApplication.keyboardModifiers() & Qt.ControlModifier):
                url = charFmt.anchorHref()

                # get global cursor position
                pos = self.cursorRect()
                pos = pos.bottomLeft()
                pos = self.viewport().mapToGlobal(pos)

                self.l.move(pos)
                self.l.setUrl(url)
                self.l.show()

        else:
            self.l.hide()
开发者ID:afester,项目名称:CodeSamples,代码行数:31,代码来源:StylableTextEdit.py

示例2: _template_clicked

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import keyboardModifiers [as 别名]
    def _template_clicked(self, index, template):
        """
        Set item's template to selected.
        If Ctrl key pressed - find next item without the template and focus on it.
        """

        self.visible_items[index].template = template
        buttons = self.findChildren(QRadioButton, name="menu_button")
        buttons[index].setText(self._get_button_name(self.visible_items[index]))

        if QGuiApplication.keyboardModifiers() != Qt.ControlModifier:
            return

        for i in range(len(self.visible_items)):
            ind = (i + index) % len(self.visible_items)
            if not self.visible_items[ind].template:
                self.templates_layout.setCurrentIndex(ind)
                buttons[ind].setChecked(True)
                buttons[index].setChecked(False)
                return
开发者ID:aq1,项目名称:Hospital-Helper-2,代码行数:22,代码来源:template_widget.py

示例3: wheelEvent

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import keyboardModifiers [as 别名]
	def wheelEvent(self, event):
		modifiers = QGuiApplication.keyboardModifiers()
		if modifiers == Qt.ControlModifier:
			font = globalSettings.editorFont
			size = font.pointSize()
			scroll = event.angleDelta().y()
			if scroll > 0:
				size += 1
			elif scroll < 0:
				size -= 1
			else:
				return
			font.setPointSize(size)
			self.parent.setEditorFont(font)
		else:
			QTextEdit.wheelEvent(self, event)

			if event.angleDelta().y() < 0:
				scrollBarLimit = self.verticalScrollBar().maximum()
			else:
				scrollBarLimit = self.verticalScrollBar().minimum()

			if self.verticalScrollBar().value() == scrollBarLimit:
				self.scrollLimitReached.emit(event)
开发者ID:starofrainnight,项目名称:retext,代码行数:26,代码来源:editor.py

示例4: keyPressEvent

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import keyboardModifiers [as 别名]
 def keyPressEvent(self, event):
     if QGuiApplication.keyboardModifiers() != Qt.ControlModifier:
         return
     if event.key() == Qt.Key_Return:
         self.action_btn_function(event=None)
开发者ID:aq1,项目名称:Hospital-Helper-2,代码行数:7,代码来源:template_widget.py


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