本文整理汇总了Python中PyQt5.QtWidgets.QAction.font方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.font方法的具体用法?Python QAction.font怎么用?Python QAction.font使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QAction
的用法示例。
在下文中一共展示了QAction.font方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import font [as 别名]
#.........这里部分代码省略.........
statusTip="Open an existing file", triggered=self.open)
self.saveAct = QAction("&Save", self, shortcut=QKeySequence.Save,
statusTip="Save the document to disk", triggered=self.save)
self.printAct = QAction("&Print...", self, shortcut=QKeySequence.Print,
statusTip="Print the document", triggered=self.print_)
self.exitAct = QAction("E&xit", self, shortcut="Ctrl+Q",
statusTip="Exit the application", triggered=self.close)
self.undoAct = QAction("&Undo", self, shortcut=QKeySequence.Undo,
statusTip="Undo the last operation", triggered=self.undo)
self.redoAct = QAction("&Redo", self, shortcut=QKeySequence.Redo,
statusTip="Redo the last operation", triggered=self.redo)
self.cutAct = QAction("Cu&t", self, shortcut=QKeySequence.Cut,
statusTip="Cut the current selection's contents to the clipboard",
triggered=self.cut)
self.copyAct = QAction("&Copy", self, shortcut=QKeySequence.Copy,
statusTip="Copy the current selection's contents to the clipboard",
triggered=self.copy)
self.pasteAct = QAction("&Paste", self, shortcut=QKeySequence.Paste,
statusTip="Paste the clipboard's contents into the current selection",
triggered=self.paste)
self.boldAct = QAction("&Bold", self, checkable=True,
shortcut="Ctrl+B", statusTip="Make the text bold",
triggered=self.bold)
boldFont = self.boldAct.font()
boldFont.setBold(True)
self.boldAct.setFont(boldFont)
self.italicAct = QAction("&Italic", self, checkable=True,
shortcut="Ctrl+I", statusTip="Make the text italic",
triggered=self.italic)
italicFont = self.italicAct.font()
italicFont.setItalic(True)
self.italicAct.setFont(italicFont)
self.setLineSpacingAct = QAction("Set &Line Spacing...", self,
statusTip="Change the gap between the lines of a paragraph",
triggered=self.setLineSpacing)
self.setParagraphSpacingAct = QAction("Set &Paragraph Spacing...",
self, statusTip="Change the gap between paragraphs",
triggered=self.setParagraphSpacing)
self.aboutAct = QAction("&About", self,
statusTip="Show the application's About box",
triggered=self.about)
self.aboutQtAct = QAction("About &Qt", self,
statusTip="Show the Qt library's About box",
triggered=self.aboutQt)
self.aboutQtAct.triggered.connect(QApplication.instance().aboutQt)
self.leftAlignAct = QAction("&Left Align", self, checkable=True,
shortcut="Ctrl+L", statusTip="Left align the selected text",
triggered=self.leftAlign)
示例2: EditableGraphicView
# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import font [as 别名]
class EditableGraphicView(ZoomableGraphicView):
save_as_clicked = pyqtSignal()
export_demodulated_clicked = pyqtSignal()
create_clicked = pyqtSignal(int, int)
set_noise_clicked = pyqtSignal()
participant_changed = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self.participants = []
self.__sample_rate = None # For default sample rate in insert sine dialog
self.protocol = None # gets overwritten in epic graphic view
self.autoRangeY = True
self.save_enabled = False # Signal is can be saved
self.create_new_signal_enabled = False
self.participants_assign_enabled = False
self.cache_qad = False # cache qad demod after edit operations?
self.__signal = None # type: Signal
self.stored_item = None # For copy/paste
self.paste_position = 0 # Where to paste? Set in contextmenuevent
self.init_undo_stack(QUndoStack())
self.addAction(self.undo_action)
self.addAction(self.redo_action)
self.copy_action = QAction(self.tr("Copy selection"), self) # type: QAction
self.copy_action.setShortcut(QKeySequence.Copy)
self.copy_action.triggered.connect(self.on_copy_action_triggered)
self.copy_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.copy_action.setIcon(QIcon.fromTheme("edit-copy"))
self.addAction(self.copy_action)
self.paste_action = QAction(self.tr("Paste"), self) # type: QAction
self.paste_action.setShortcut(QKeySequence.Paste)
self.paste_action.triggered.connect(self.on_paste_action_triggered)
self.paste_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.paste_action.setIcon(QIcon.fromTheme("edit-paste"))
self.addAction(self.paste_action)
self.delete_action = QAction(self.tr("Delete selection"), self)
self.delete_action.setShortcut(QKeySequence.Delete)
self.delete_action.triggered.connect(self.on_delete_action_triggered)
self.delete_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.delete_action.setIcon(QIcon.fromTheme("edit-delete"))
self.addAction(self.delete_action)
self.save_as_action = QAction(self.tr("Save Signal as..."), self) # type: QAction
self.save_as_action.setIcon(QIcon.fromTheme("document-save-as"))
self.save_as_action.setShortcut(QKeySequence.SaveAs)
self.save_as_action.triggered.connect(self.save_as_clicked.emit)
self.save_as_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.addAction(self.save_as_action)
self.insert_sine_action = QAction(self.tr("Insert sine wave..."), self)
font = self.insert_sine_action.font()
font.setBold(True)
self.insert_sine_action.setFont(font)
self.insert_sine_action.triggered.connect(self.on_insert_sine_action_triggered)
self.insert_sine_plugin = InsertSinePlugin()
self.insert_sine_plugin.insert_sine_wave_clicked.connect(self.on_insert_sine_wave_clicked)
def init_undo_stack(self, undo_stack):
self.undo_stack = undo_stack
self.undo_action = self.undo_stack.createUndoAction(self)
self.undo_action.setIcon(QIcon.fromTheme("edit-undo"))
self.undo_action.setShortcut(QKeySequence.Undo)
self.undo_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.redo_action = self.undo_stack.createRedoAction(self)
self.redo_action.setIcon(QIcon.fromTheme("edit-redo"))
self.redo_action.setShortcut(QKeySequence.Redo)
self.redo_action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
self.undo_stack.indexChanged.connect(self.on_undo_stack_index_changed)
def eliminate(self):
self.participants = None
self.stored_item = None
if self.signal is not None:
self.signal.eliminate()
self.__signal = None
self.insert_sine_plugin = None
self.undo_action = None
self.redo_action = None
self.undo_stack = None
super().eliminate()
@property
def sample_rate(self) -> float:
return self.__sample_rate
@sample_rate.setter
def sample_rate(self, value):
#.........这里部分代码省略.........
示例3: ListLayout
# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import font [as 别名]
class ListLayout(QWidget, CueLayout):
NAME = 'List Layout'
DESCRIPTION = '''
This layout organize the cues in a list:
<ul>
<li>Unlimited cues;
<li>Side panel with playing media-cues;
<li>Cues can be moved in the list;
<li>Keyboard control;
</ul>'''
HEADER = ['', 'Cue', 'Duration', 'Progress']
# I need to redefine those from CueLayout
key_pressed = CueLayout.key_pressed
cue_added = CueLayout.cue_added
cue_removed = CueLayout.cue_removed
focus_changed = CueLayout.focus_changed
def __init__(self, app, **kwds):
super().__init__(**kwds)
self.mainWindow = app.mainWindow
self.menuLayout = self.mainWindow.menuLayout
self._cue_items = []
self._playing_widgets = {}
self._context_item = None
self._show_dbmeter = config['ListLayout']['ShowDbMeters'] == 'True'
self._show_seek = config['ListLayout']['ShowSeek'] == 'True'
self._accurate_time = config['ListLayout']['ShowAccurate'] == 'True'
self._auto_next = config['ListLayout']['AutoNext'] == 'True'
# Add layout-specific menus
self.showDbMeterAction = QAction(self)
self.showDbMeterAction.setCheckable(True)
self.showDbMeterAction.setChecked(self._show_dbmeter)
self.showDbMeterAction.triggered.connect(self.set_dbmeter_visible)
self.showSeekAction = QAction(self)
self.showSeekAction.setCheckable(True)
self.showSeekAction.setChecked(self._show_seek)
self.showSeekAction.triggered.connect(self.set_seek_visible)
self.accurateTimingAction = QAction(self)
self.accurateTimingAction.setCheckable(True)
self.accurateTimingAction.setChecked(self._accurate_time)
self.accurateTimingAction.triggered.connect(self.set_accurate_time)
self.autoNextAction = QAction(self)
self.autoNextAction.setCheckable(True)
self.autoNextAction.setChecked(self._auto_next)
self.autoNextAction.triggered.connect(self.set_auto_next)
self.menuLayout.addAction(self.showDbMeterAction)
self.menuLayout.addAction(self.showSeekAction)
self.menuLayout.addAction(self.accurateTimingAction)
self.menuLayout.addAction(self.autoNextAction)
# Add a toolbar to MainWindow
self.toolBar = QToolBar(self.mainWindow)
self.toolBar.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
self.playAction = QAction(self)
self.playAction.setIcon(QIcon.fromTheme("media-playback-start"))
self.playAction.triggered.connect(self.play_current)
self.pauseAction = QAction(self)
self.pauseAction.setIcon(QIcon.fromTheme("media-playback-pause"))
self.pauseAction.triggered.connect(self.pause_current)
self.stopAction = QAction(self)
self.stopAction.setIcon(QIcon.fromTheme("media-playback-stop"))
self.stopAction.triggered.connect(self.stop_current)
self.stopAllAction = QAction(self)
self.stopAllAction.font().setBold(True)
self.stopAllAction.triggered.connect(self.stop_all)
self.pauseAllAction = QAction(self)
self.pauseAllAction.font().setBold(True)
self.pauseAllAction.triggered.connect(self.pause_all)
self.restartAllAction = QAction(self)
self.restartAllAction.font().setBold(True)
self.restartAllAction.triggered.connect(self.restart_all)
self.toolBar.addAction(self.playAction)
self.toolBar.addAction(self.pauseAction)
self.toolBar.addAction(self.stopAction)
self.toolBar.addSeparator()
self.toolBar.addAction(self.stopAllAction)
self.toolBar.addAction(self.pauseAllAction)
self.toolBar.addAction(self.restartAllAction)
self.mainWindow.addToolBar(self.toolBar)
self.hLayout = QHBoxLayout(self)
#.........这里部分代码省略.........