本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEngineView.zoomFactor方法的典型用法代码示例。如果您正苦于以下问题:Python QWebEngineView.zoomFactor方法的具体用法?Python QWebEngineView.zoomFactor怎么用?Python QWebEngineView.zoomFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebEngineWidgets.QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView.zoomFactor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import zoomFactor [as 别名]
class MainWindow(QMainWindow):
"""Main window class."""
def __init__(self):
"""Init class."""
super(MainWindow, self).__init__()
self.pixmap_syncthingui = QPixmap(":/images/syncthingui.svg")
tf = QTransform()
self.pixmap_syncthingui0 = QPixmap(":/images/syncthingui.svg")
tf.rotate(90.0)
self.pixmap_syncthingui1 = self.pixmap_syncthingui0.transformed(tf)
tf.rotate(180.0)
self.pixmap_syncthingui2 = self.pixmap_syncthingui0.transformed(tf)
tf.rotate(270.0)
self.pixmap_syncthingui3 = self.pixmap_syncthingui0.transformed(tf)
self.init_gui()
self.init_menu()
self.init_systray()
self.run()
def init_gui(self):
"""init gui setup"""
self.setWindowIcon(QIcon(self.pixmap_syncthingui))
self.progressbar = QProgressBar()
self.statusBar().showMessage(getoutput(SYNCTHING + ' --version'))
self.statusBar().addPermanentWidget(self.progressbar)
self.setWindowTitle(__doc__.strip().capitalize())
self.setMinimumSize(900, 600)
self.setMaximumSize(1280, 1024)
self.resize(self.minimumSize())
self.center()
# QWebView
# self.view = QWebView(self)
self.view = QWebEngineView(self)
self.view.loadStarted.connect(self.start_loading)
self.view.loadFinished.connect(self.finish_loading)
self.view.loadProgress.connect(self.loading)
self.view.titleChanged.connect(self.set_title)
self.view.page().linkHovered.connect(
lambda link_txt: self.statusBar().showMessage(link_txt[:99], 3000))
QShortcut("Ctrl++", self, activated=lambda:
self.view.setZoomFactor(self.view.zoomFactor() + 0.2))
QShortcut("Ctrl+-", self, activated=lambda:
self.view.setZoomFactor(self.view.zoomFactor() - 0.2))
QShortcut("Ctrl+0", self, activated=lambda: self.view.setZoomFactor(1))
QShortcut("Ctrl+q", self, activated=lambda: self.close())
# syncthing console
self.consolewidget = QWidget(self)
# TODO: start at specify (w,h)
self.consolewidget.setMinimumSize(QSize(200, 100))
# TODO: setStyleSheet
# self.consolewidget.setStyleSheet("margin:0px; padding: 0px; \
# border:1px solid rgb(0, 0, 0);")
# border-radius: 40px;")
# TODO read syncthing console visible from setting
# self.consolewidget.setVisible(False)
# self.consolewidget.showEvent
# self.consoletextedit = QPlainTextEdit(parent=self.consolewidget)
self.consoletoolbar = QWidget(self)
hlayout = QHBoxLayout()
hlayout
self.consoletoolbar.setLayout(hlayout)
self.consoletextedit = QTextEdit(parent=self.consolewidget)
self.consoletextedit.setWordWrapMode(QTextOption.NoWrap)
# self.consoletextedit.setStyleSheet(" border:1px solid rgb(0, 0, 0);")
# self.consoletextedit.setStyleSheet("margin:0px; padding: 0px;")
layout = QVBoxLayout()
layout.addWidget(self.consoletoolbar)
layout.addWidget(self.consoletextedit)
self.consolewidget.setLayout(layout)
self.splitter = QSplitter(Qt.Vertical)
self.splitter.addWidget(self.view)
self.splitter.addWidget(self.consolewidget)
# process
self.process = QProcess()
self.process.error.connect(self._process_failed)
# QProcess emits `readyRead` when there is data to be read
self.process.readyRead.connect(self._process_dataReady)
self.process.stateChanged.connect(self._process_stateChanged)
# Just to prevent accidentally running multiple times
# Disable the button when process starts, and enable it when it finishes
# self.process.started.connect(lambda: self.runButton.setEnabled(False))
# self.process.finished.connect(lambda: self.runButton.setEnabled(True))
# backend options
self.chrt = QCheckBox("Smooth CPU ", checked=True)
self.ionice = QCheckBox("Smooth HDD ", checked=True)
self.chrt.setToolTip("Use Smooth CPUs priority (recommended)")
self.ionice.setToolTip("Use Smooth HDDs priority (recommended)")
self.chrt.setStatusTip(self.chrt.toolTip())
self.ionice.setStatusTip(self.ionice.toolTip())
#.........这里部分代码省略.........