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


Python Qt.ControlModifier方法代码示例

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


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

示例1: mousePressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def mousePressEvent(self, e):
        """Set the tabdata ClickTarget on a mousepress.

        This is implemented here as we don't need it for QtWebEngine.
        """
        if e.button() == Qt.MidButton or e.modifiers() & Qt.ControlModifier:
            background = config.val.tabs.background
            if e.modifiers() & Qt.ShiftModifier:
                background = not background
            if background:
                target = usertypes.ClickTarget.tab_bg
            else:
                target = usertypes.ClickTarget.tab
            self._tabdata.open_target = target
            log.mouse.debug("Ctrl/Middle click, setting target: {}".format(
                target))
        else:
            self._tabdata.open_target = usertypes.ClickTarget.normal
            log.mouse.debug("Normal click, setting normal target")
        super().mousePressEvent(e) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:22,代码来源:webview.py

示例2: mouseMoveEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def mouseMoveEvent(self, event):
        if (event.buttons() == Qt.LeftButton and
                (event.modifiers() == Qt.ControlModifier or
                         event.modifiers() == Qt.ShiftModifier)):
            mime_data = QMimeData()
            mime_data.setText(PageWidget.DRAG_MAGIC)

            drag = QDrag(self)
            drag.setMimeData(mime_data)
            drag.setPixmap(self.grab(self.rect()))

            if event.modifiers() == Qt.ControlModifier:
                drag.exec_(Qt.MoveAction)
            else:
                drag.exec_(Qt.CopyAction)

            event.accept()
        else:
            event.ignore() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:21,代码来源:cue_widget.py

示例3: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def __init__(self, event, config):
        # * self.win = QMainWindow Instance
        # * self.view = QTWebEngine Instance
        if event.type() == event.KeyPress:
            if event.key() == Qt.Key_F11:
                if config['webview']["online"] is True or config['window']["showHelpMenu"] is True:
                    self.full_screen()
            elif event.key() == Qt.Key_F10:
                if config['webview']["online"] is True or config['window']["showHelpMenu"] is True:
                    self.win = Instance.retrieve("win")
                    self.win.corner_window()

            elif event.modifiers() == Qt.ControlModifier:

                if event.key() == Qt.Key_Minus:
                    self._zoom_out()

                elif event.key() == Qt.Key_Equal:
                    self._zoom_in() 
开发者ID:codesardine,项目名称:Jade-Application-Kit,代码行数:21,代码来源:KeyBindings.py

示例4: mousePressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def mousePressEvent(self, e):
        super().mousePressEvent(e)

        if QGuiApplication.queryKeyboardModifiers() == Qt.ControlModifier:
            word = self.wordAtLineIndex(
                self.getCursorPosition()[0], self.getCursorPosition()[1]
            )
            print(word)
            if self.check_if_func(word):
                url = "https://docs.python.org/3/library/functions.html#" + word
                self.parent.parent.openBrowser(
                    url, word
                )  # Runs the openBrowser function in Main class
            elif self.check_if_error(word):
                url = "https://docs.python.org/3/library/exceptions.html#" + word
                print(url)

                self.parent.parent.openBrowser(url, word) 
开发者ID:CountryTk,项目名称:Hydra,代码行数:20,代码来源:TextEditor.py

示例5: filterKeyPressInHostsTableView

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def filterKeyPressInHostsTableView(self, key, receiver):
        if not receiver.selectionModel().selectedRows():
            return True

        index = receiver.selectionModel().selectedRows()[0].row()

        if key == Qt.Key_Down:
            new_index = index + 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif key == Qt.Key_Up:
            new_index = index - 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif QApplication.keyboardModifiers() == Qt.ControlModifier and key == Qt.Key_C:
            selected = receiver.selectionModel().currentIndex()
            clipboard = QApplication.clipboard()
            clipboard.setText(selected.data().toString())
        return True 
开发者ID:GoVanguard,项目名称:legion,代码行数:21,代码来源:eventfilter.py

示例6: test_eventFilter_whenKeyCPressed_SelectsPreviousRowAndEmitsClickEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_eventFilter_whenKeyCPressed_SelectsPreviousRowAndEmitsClickEvent(
            self, hosts_table_view, selection_model, selected_row, mock_clipboard):
        expected_data = MagicMock()
        expected_data.toString = Mock(return_value="some clipboard data")
        control_modifier = mock.patch.object(QApplication, 'keyboardModifiers', return_value=Qt.ControlModifier)
        clipboard = mock.patch.object(QApplication, 'clipboard', return_value=mock_clipboard)

        self.mock_view.ui.HostsTableView = hosts_table_view
        event_filter = MyEventFilter(self.mock_view, self.mock_main_window)
        self.simulateKeyPress(Qt.Key_C)
        self.mock_receiver = hosts_table_view
        selected_row.data = Mock(return_value=expected_data)
        selection_model.currentIndex = Mock(return_value=selected_row)
        self.mock_receiver.selectionModel = Mock(return_value=selection_model)

        with control_modifier, clipboard:
            result = event_filter.eventFilter(self.mock_receiver, self.mock_event)
            self.assertTrue(result)
            mock_clipboard.setText.assert_called_once_with("some clipboard data") 
开发者ID:GoVanguard,项目名称:legion,代码行数:21,代码来源:test_eventfilter.py

示例7: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def keyPressEvent(self, event):

        QtWidgets.QWidget.keyPressEvent(self, event)

        if event.matches(QtGui.QKeySequence.Copy):
            print('Ctrl + C')
            self.dataView.copy()
        if event.matches(QtGui.QKeySequence.Paste):
            self.dataView.paste()
            print('Ctrl + V')
        if event.key() == Qt.Key_P and (event.modifiers() & Qt.ControlModifier):
            self.dataView.print()
            print('Ctrl + P')
        if event.key() == Qt.Key_D and (event.modifiers() & Qt.ControlModifier):
            self.debug()
            print('Ctrl + D') 
开发者ID:adamerose,项目名称:pandasgui,代码行数:18,代码来源:dataframe_viewer.py

示例8: test_Window_wheelEvent_zoom_in

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_Window_wheelEvent_zoom_in(qtapp):
    """
    If the CTRL+scroll in a positive direction, zoom in.
    """
    w = mu.interface.main.Window()
    w.zoom_in = mock.MagicMock()
    mock_event = mock.MagicMock()
    mock_event.angleDelta().y.return_value = 1
    modifiers = Qt.ControlModifier
    with mock.patch(
        "mu.interface.main.QApplication.keyboardModifiers",
        return_value=modifiers,
    ):
        w.wheelEvent(mock_event)
        w.zoom_in.assert_called_once_with()
        mock_event.ignore.assert_called_once_with() 
开发者ID:mu-editor,项目名称:mu,代码行数:18,代码来源:test_main.py

示例9: test_Window_wheelEvent_zoom_out

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_Window_wheelEvent_zoom_out(qtapp):
    """
    If the CTRL+scroll in a negative direction, zoom out.
    """
    w = mu.interface.main.Window()
    w.zoom_out = mock.MagicMock()
    mock_event = mock.MagicMock()
    mock_event.angleDelta().y.return_value = -1
    modifiers = Qt.ControlModifier
    with mock.patch(
        "mu.interface.main.QApplication.keyboardModifiers",
        return_value=modifiers,
    ):
        w.wheelEvent(mock_event)
        w.zoom_out.assert_called_once_with()
        mock_event.ignore.assert_called_once_with() 
开发者ID:mu-editor,项目名称:mu,代码行数:18,代码来源:test_main.py

示例10: test_PythonProcessPane_parse_input_ctrl_c

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_PythonProcessPane_parse_input_ctrl_c(qtapp):
    """
    Control-C (SIGINT / KeyboardInterrupt) character is typed.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    ppp.process = mock.MagicMock()
    ppp.process.processId.return_value = 123
    ppp.running = True
    key = Qt.Key_C
    text = ""
    modifiers = Qt.ControlModifier
    mock_kill = mock.MagicMock()
    mock_timer = mock.MagicMock()
    with mock.patch("mu.interface.panes.os.kill", mock_kill), mock.patch(
        "mu.interface.panes.QTimer", mock_timer
    ), mock.patch("mu.interface.panes.platform.system", return_value="win32"):
        ppp.parse_input(key, text, modifiers)
    mock_kill.assert_called_once_with(123, signal.SIGINT)
    ppp.process.readAll.assert_called_once_with()
    mock_timer.singleShot.assert_called_once_with(1, ppp.on_process_halt) 
开发者ID:mu-editor,项目名称:mu,代码行数:22,代码来源:test_panes.py

示例11: test_PythonProcessPane_parse_input_ctrl_d

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_PythonProcessPane_parse_input_ctrl_d(qtapp):
    """
    Control-D (Kill process) character is typed.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    ppp.process = mock.MagicMock()
    ppp.running = True
    key = Qt.Key_D
    text = ""
    modifiers = Qt.ControlModifier
    mock_timer = mock.MagicMock()
    with mock.patch(
        "mu.interface.panes.platform.system", return_value="win32"
    ), mock.patch("mu.interface.panes.QTimer", mock_timer):
        ppp.parse_input(key, text, modifiers)
        ppp.process.kill.assert_called_once_with()
    ppp.process.readAll.assert_called_once_with()
    mock_timer.singleShot.assert_called_once_with(1, ppp.on_process_halt) 
开发者ID:mu-editor,项目名称:mu,代码行数:20,代码来源:test_panes.py

示例12: test_PythonProcessPane_parse_input_ctrl_c_after_process_finished

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_PythonProcessPane_parse_input_ctrl_c_after_process_finished(qtapp):
    """
    Control-C (SIGINT / KeyboardInterrupt) character is typed.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    ppp.process = mock.MagicMock()
    ppp.process.processId.return_value = 123
    ppp.running = False
    key = Qt.Key_C
    text = ""
    modifiers = Qt.ControlModifier
    mock_kill = mock.MagicMock()
    with mock.patch("mu.interface.panes.os.kill", mock_kill), mock.patch(
        "mu.interface.panes.platform.system", return_value="win32"
    ):
        ppp.parse_input(key, text, modifiers)
    assert mock_kill.call_count == 0 
开发者ID:mu-editor,项目名称:mu,代码行数:19,代码来源:test_panes.py

示例13: eventFilter

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def eventFilter(self, obj, e):
        if obj == self.command and e.type() == QEvent.KeyPress:
            history = self.device.history
            if e.modifiers() & Qt.ControlModifier:
                if e.key() == Qt.Key_H:
                    d = DeviceConsoleHistory(self.device.env.devices)
                    if d.exec_() == QDialog.Accepted:
                        self.command.setText(d.command)

                elif len(history) > 0:
                    if e.key() == Qt.Key_E:
                        self.command.setText(history[0])

                    if e.key() == Qt.Key_Down:
                        self.command.completer().setModel(QStringListModel(history))
                        self.command.setText(' ')
                        self.command.completer().complete()
            return False

        return QDockWidget.eventFilter(self, obj, e) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:22,代码来源:Console.py

示例14: test_valid_key

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_valid_key(self, prompt_keyparser, handle_text):
        modifier = Qt.MetaModifier if utils.is_mac else Qt.ControlModifier

        infos = [
            keyutils.KeyInfo(Qt.Key_A, modifier),
            keyutils.KeyInfo(Qt.Key_X, modifier),
        ]
        for info in infos:
            prompt_keyparser.handle(info.to_event())

        prompt_keyparser.execute.assert_called_once_with(
            'message-info ctrla', None)
        assert not prompt_keyparser._sequence 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:15,代码来源:test_basekeyparser.py

示例15: test_valid_key_count

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ControlModifier [as 别名]
def test_valid_key_count(self, prompt_keyparser):
        modifier = Qt.MetaModifier if utils.is_mac else Qt.ControlModifier

        infos = [
            keyutils.KeyInfo(Qt.Key_5, Qt.NoModifier),
            keyutils.KeyInfo(Qt.Key_A, modifier),
        ]
        for info in infos:
            prompt_keyparser.handle(info.to_event())
        prompt_keyparser.execute.assert_called_once_with(
            'message-info ctrla', 5) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:13,代码来源:test_basekeyparser.py


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