本文整理汇总了Python中qtpy.QtWidgets.QApplication.keyboardModifiers方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.keyboardModifiers方法的具体用法?Python QApplication.keyboardModifiers怎么用?Python QApplication.keyboardModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.keyboardModifiers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: forward
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import keyboardModifiers [as 别名]
def forward(self):
if len(self.forward_stack) > 0:
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
stack_item = self.forward_stack[-1]
self.new_abs_window(filename=stack_item[0], macros=stack_item[1], command_line_args=stack_item[2])
else:
stack_item = self.forward_stack.pop()
self.open_abs_file(filename=stack_item[0], macros=stack_item[1], command_line_args=stack_item[2])
示例2: home
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import keyboardModifiers [as 别名]
def home(self):
if self.home_file is None:
return
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
self.new_abs_window(filename=self.home_file[0], macros=self.home_file[1], command_line_args=self.home_file[2])
else:
self.go_abs(self.home_file[0], macros=self.home_file[1], command_line_args=self.home_file[2])
示例3: go_button_pressed
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import keyboardModifiers [as 别名]
def go_button_pressed(self):
filename = str(self.ui.panelSearchLineEdit.text())
if not filename:
return
try:
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
self.app.new_window(filename)
else:
self.go(filename)
except (IOError, OSError, ValueError, ImportError) as e:
self.handle_open_file_error(filename, e)
示例4: eventFilter
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import keyboardModifiers [as 别名]
def eventFilter(self, widget, event):
"""A filter to control the zooming and panning of the figure canvas."""
# ---- Zooming
if event.type() == QEvent.Wheel:
modifiers = QApplication.keyboardModifiers()
if modifiers == Qt.ControlModifier:
if event.angleDelta().y() > 0:
self.zoom_in()
else:
self.zoom_out()
return True
else:
return False
# ---- Panning
# Set ClosedHandCursor:
elif event.type() == QEvent.MouseButtonPress:
if event.button() == Qt.LeftButton:
QApplication.setOverrideCursor(Qt.ClosedHandCursor)
self._ispanning = True
self.xclick = event.globalX()
self.yclick = event.globalY()
# Reset Cursor:
elif event.type() == QEvent.MouseButtonRelease:
QApplication.restoreOverrideCursor()
self._ispanning = False
# Move ScrollBar:
elif event.type() == QEvent.MouseMove:
if self._ispanning:
dx = self.xclick - event.globalX()
self.xclick = event.globalX()
dy = self.yclick - event.globalY()
self.yclick = event.globalY()
scrollBarH = self.horizontalScrollBar()
scrollBarH.setValue(scrollBarH.value() + dx)
scrollBarV = self.verticalScrollBar()
scrollBarV.setValue(scrollBarV.value() + dy)
return QWidget.eventFilter(self, widget, event)
示例5: open_file_action
# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import keyboardModifiers [as 别名]
def open_file_action(self, checked):
modifiers = QApplication.keyboardModifiers()
try:
curr_file = self.current_file()
folder = os.path.dirname(curr_file)
except IndexError:
folder = os.getcwd()
filename = QFileDialog.getOpenFileName(self, 'Open File...', folder, 'PyDM Display Files (*.ui *.py)')
filename = filename[0] if isinstance(filename, (list, tuple)) else filename
if filename:
filename = str(filename)
try:
if modifiers == Qt.ShiftModifier:
self.app.new_window(filename)
else:
self.open_file(filename)
except (IOError, OSError, ValueError, ImportError) as e:
self.handle_open_file_error(filename, e)