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


Python Qt.AltModifier方法代码示例

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


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

示例1: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def keyPressEvent(self, event):
        """Reimplemented."""
        # Override the default QComboBox behavior
        if event.key() == Qt.Key_Down and event.modifiers() & Qt.AltModifier:
            self.showPopup()
            return

        ignored = {Qt.Key_Up, Qt.Key_Down,
                   Qt.Key_PageDown, Qt.Key_PageUp,
                   Qt.Key_Home, Qt.Key_End}

        if event.key() in ignored:
            event.ignore()
            return

        super(CheckComboBox, self).keyPressEvent(event) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:18,代码来源:qcheckcombobox.py

示例2: _click_fake_event

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def _click_fake_event(self, click_target: usertypes.ClickTarget,
                          button: Qt.MouseButton = Qt.LeftButton) -> None:
        """Send a fake click event to the element."""
        pos = self._mouse_pos()

        log.webelem.debug("Sending fake click to {!r} at position {} with "
                          "target {}".format(self, pos, click_target))

        target_modifiers = {
            usertypes.ClickTarget.normal: Qt.NoModifier,
            usertypes.ClickTarget.window: Qt.AltModifier | Qt.ShiftModifier,
            usertypes.ClickTarget.tab: Qt.ControlModifier,
            usertypes.ClickTarget.tab_bg: Qt.ControlModifier,
        }
        if config.val.tabs.background:
            target_modifiers[usertypes.ClickTarget.tab] |= Qt.ShiftModifier
        else:
            target_modifiers[usertypes.ClickTarget.tab_bg] |= Qt.ShiftModifier

        modifiers = typing.cast(Qt.KeyboardModifiers,
                                target_modifiers[click_target])

        events = [
            QMouseEvent(QEvent.MouseMove, pos, Qt.NoButton, Qt.NoButton,
                        Qt.NoModifier),
            QMouseEvent(QEvent.MouseButtonPress, pos, button, button,
                        modifiers),
            QMouseEvent(QEvent.MouseButtonRelease, pos, button, Qt.NoButton,
                        modifiers),
        ]

        for evt in events:
            self._tab.send_event(evt)

        QTimer.singleShot(0, self._move_text_cursor) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:37,代码来源:webelem.py

示例3: key_event_sequence

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def key_event_sequence(event):
        val = event.key()
        mod = event.modifiers()
        if mod & Qt.ShiftModifier:
            val += Qt.SHIFT
        if mod & Qt.ControlModifier:
            val += Qt.CTRL
        if mod & Qt.AltModifier:
            val += Qt.ALT
        if mod & Qt.MetaModifier:
            val += Qt.META
        return QKeySequence(val) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:14,代码来源:qt_helper.py

示例4: onKeyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def onKeyPressEvent(self, e):
        if not e.isAutoRepeat():
            keys = e.key()
            modifiers = e.modifiers()

            if modifiers & Qt.ShiftModifier:
                keys += Qt.SHIFT
            if modifiers & Qt.ControlModifier:
                keys += Qt.CTRL
            if modifiers & Qt.AltModifier:
                keys += Qt.ALT
            if modifiers & Qt.MetaModifier:
                keys += Qt.META

            if QKeySequence(keys) in self._go_key_sequence:
                self.go()
            elif e.key() == Qt.Key_Space:
                if qApp.keyboardModifiers() == Qt.ShiftModifier:
                    cue = self.current_cue()
                    if cue is not None:
                        self.edit_cue(cue)
                elif qApp.keyboardModifiers() == Qt.ControlModifier:
                    item = self.current_item()
                    if item is not None:
                        item.selected = not item.selected
            else:
                self.key_pressed.emit(e)

        e.accept() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:31,代码来源:layout.py

示例5: toggle

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def toggle(app_window):
    config.logger.info("controller:toggle()")
    config.app_window = app_window
    modifiers = QApplication.keyboardModifiers()
    if modifiers == Qt.AltModifier:
        # ALT-click (OPTION on macOS) sends the log file by email
        util.sendLog()
    elif modifiers == (Qt.AltModifier | Qt.ControlModifier):
        # ALT+CTR-CLICK (OPTION+COMMAND on macOS) toggles the plus debug logging 
        util.debugLogToggle()
    else:
        if config.app_window.plus_account is None: # @UndefinedVariable
            connect()
            if is_connected() and is_synced() and config.app_window.curFile is not None: # @UndefinedVariable
                sync.sync()         
        else:
            if config.connected:
                if is_synced():
                    # a CTR-click (COMMAND on macOS) logs out and discards the credentials
                    disconnect(interactive=True,remove_credentials=(modifiers == Qt.ControlModifier))
                else:
                    # we (manually) turn syncing for the current roast on
                    if app_window.qmc.checkSaved(allow_discard=False):
                        queue.addRoast()
            else:
                connect(True) # we try to re-connect and disconnect on failure 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:28,代码来源:controller.py

示例6: copyEventTabletoClipboard

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def copyEventTabletoClipboard(self,_=False):
        nrows = self.eventtable.rowCount() 
        ncols = self.eventtable.columnCount()
        clipboard = ""
        modifiers = QApplication.keyboardModifiers()
        if modifiers == Qt.AltModifier:  #alt click
            tbl = prettytable.PrettyTable()
            fields = []
            for c in range(ncols):
                fields.append(self.eventtable.horizontalHeaderItem(c).text())
            tbl.field_names = fields
            for i in range(nrows):
                rows = []
                rows.append(self.eventtable.cellWidget(i,0).text())
                rows.append(self.eventtable.cellWidget(i,1).text())
                rows.append(self.eventtable.cellWidget(i,2).text())
                rows.append(self.eventtable.cellWidget(i,3).text())
                rows.append(self.eventtable.cellWidget(i,4).currentText())
                rows.append(self.eventtable.cellWidget(i,5).text())
                tbl.add_row(rows)
            clipboard = tbl.get_string()
        else:
            for c in range(ncols):
                clipboard += self.eventtable.horizontalHeaderItem(c).text()
                if c != (ncols-1):
                    clipboard += '\t'
            clipboard += '\n'
            for r in range(nrows):
                clipboard += self.eventtable.cellWidget(r,0).text() + "\t"
                clipboard += self.eventtable.cellWidget(r,1).text() + "\t"
                clipboard += self.eventtable.cellWidget(r,2).text() + "\t"
                clipboard += self.eventtable.cellWidget(r,3).text() + "\t"
                clipboard += self.eventtable.cellWidget(r,4).currentText() + "\t"
                clipboard += self.eventtable.cellWidget(r,5).text() + "\n"
        # copy to the system clipboard
        sys_clip = QApplication.clipboard()
        sys_clip.setText(clipboard)
        self.aw.sendmessage(QApplication.translate("Message","Event table copied to clipboard",None)) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:40,代码来源:roast_properties.py

示例7: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import AltModifier [as 别名]
def keyPressEvent(self, event):
        ''' Handle keyboard input for bluesky. '''
        # Enter-key: enter command
        if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return:
            if self.command_line:
                # emit a signal with the command for the simulation thread
                self.stack(self.command_line)
                # Clear any shape command preview on the radar display
                # self.radarwidget.previewpoly(None)
                return

        newcmd = self.command_line
        cursorpos = None
        if event.key() >= Qt.Key_Space and event.key() <= Qt.Key_AsciiTilde:
            pos = self.lineEdit.cursor_pos()
            newcmd = newcmd[:pos] + event.text() + newcmd[pos:]
            # Update the cursor position with the length of the added text
            cursorpos = pos + len(event.text())
        elif event.key() == Qt.Key_Backspace:
            pos = self.lineEdit.cursor_pos()
            newcmd = newcmd[:pos - 1] + newcmd[pos:]
            cursorpos = pos - 1
        elif event.key() == Qt.Key_Tab:
            if newcmd:
                newcmd, displaytext = autocomplete.complete(newcmd)
                if displaytext:
                    self.echo(displaytext)
        elif not event.modifiers() & (Qt.ControlModifier | Qt.ShiftModifier | 
                                        Qt.AltModifier | Qt.MetaModifier):
            if event.key() == Qt.Key_Up:
                if self.history_pos == 0:
                    self.command_mem = newcmd
                if len(self.command_history) >= self.history_pos + 1:
                    self.history_pos += 1
                    newcmd = self.command_history[-self.history_pos]

            elif event.key() == Qt.Key_Down:
                if self.history_pos > 0:
                    self.history_pos -= 1
                    if self.history_pos == 0:
                        newcmd = self.command_mem
                    else:
                        newcmd = self.command_history[-self.history_pos]

            elif event.key() == Qt.Key_Left:
                self.lineEdit.cursor_left()

            elif event.key() == Qt.Key_Right:
                self.lineEdit.cursor_right()
            else:
                # Remaining keys are things like sole modifier keys, and function keys
                super(Console, self).keyPressEvent(event)
        else:
            event.ignore()
            return

        # Final processing of the command line
        self.set_cmdline(newcmd, cursorpos) 
开发者ID:TUDelft-CNS-ATM,项目名称:bluesky,代码行数:60,代码来源:console.py


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