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


Python QWebEngineView.setStyleSheet方法代码示例

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


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

示例1: Ui_MainWindow

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setStyleSheet [as 别名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.qwebengine = QWebEngineView(self.centralwidget)
        self.qwebengine.setGeometry(QtCore.QRect(10, 30, 451, 321))
        self.qwebengine.setAutoFillBackground(False)
        self.qwebengine.setStyleSheet("background-color: rgb(170, 170, 127);")
        self.qwebengine.setObjectName("qwebengine")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
开发者ID:kiorry,项目名称:PYQT,代码行数:28,代码来源:Ui_plotly_pyqt.py

示例2: DrrrWindow

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setStyleSheet [as 别名]
class DrrrWindow(ShadowsWindow):
    def __init__(self):
        super(DrrrWindow, self).__init__()
        self.setWindowTitle("Drrr Chat Room")
        self.setWindowIcon(QIcon('./img/drrr.ico'))

        # w = WebView()
        # w.show()
        self.getSetting()

        self.WebView = QWebEngineView()
        # self.WebView.load(QUrl("file:///E:/Project/DrrrPC/img/index.html"))
        self.WebView.setZoomFactor(0.8)

        # 设置加载网页,和网页加载完成以及加载过程信号与槽函数关联
        self.WebView.loadStarted.connect(self.loadStarted)
        self.WebView.loadFinished.connect(self.loadFinished)
        self.WebView.loadProgress.connect(self.loading)

        self.cookieJar = QNetworkCookieJar()
        # self.WebView.page().networkAccessManager().setCookieJar(self.cookieJar)
        # self.WebView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        # self.WebView.page().linkClicked.connect(self.linkClicked)
        # self.WebView.page().contentsChanged.connect(self.contentsChanged)
        # self.WebView.page().networkAccessManager().setHeader(QNetworkRequest.ContentTypeHeader, QVariant("text/html; charset=GBK"))


        # 重定义QWebEnginePage中javaScriptAlert等函数
        self.WebView.page().javaScriptAlert = self._javascript_alert                
        self.WebView.page().javaScriptConsoleMessage = self._javascript_console_message
        self.WebView.page().javaScriptConfirm = self._javascript_confirm
        self.WebView.page().javaScriptPrompt = self._javascript_prompt

        # NetworkAccessManager
        # self.NetworkAccessManager = QNetworkAccessManager()
        # self.WebView.page().setNetworkAccessManager(self.NetworkAccessManager)
        # self.NetworkAccessManager.finished.connect(self.NetworkAccessManagerReplyFinished)        
        # self.NetworkAccessManager.get(QNetworkRequest(QUrl("http://www.baidu.com")))        

        # self.old_manager = self.WebView.page().networkAccessManager()
        # self.new_manager = NetworkAccessManager(self.old_manager)
        # self.WebView.page().setNetworkAccessManager(self.new_manager)

        self.titlebar = titleBar()
        self.statusBar = StatusWindow()

        # 中心窗口布局
        self.contentLayout = QVBoxLayout()
        self.contentWidget = QWidget()
        self.contentWidget.gridLayout = QtWidgets.QGridLayout(self.contentWidget)
        self.contentWidget.gridLayout.addLayout(self.contentLayout, 0, 0, 1, 1)
        self.contentLayout.addWidget(self.WebView)
        self.contentWidget.gridLayout.setContentsMargins(0,0,0,0)
        self.contentLayout.setContentsMargins(1,0,1,0)
        self.contentWidget.setStyleSheet("""
            border-left:    1px solid black;
            border-right:   1px solid black;
            """)

        # self.titlebar.titlebarBotton = QPushButton(self.titlebar)
        # self.titlebar.titlebarBotton.setText('Push ME')
        # self.titlebar.titlebarBotton.clicked.connect(self.getData)

        self.main_layout = QVBoxLayout()
        self.main_layout.addWidget(self.titlebar)
        self.main_layout.addWidget(self.contentWidget)
        self.main_layout.addWidget(self.statusBar)
        self.main_layout.setSpacing(0)

        # 窗口属性
        self.setWindowFlags(Qt.Widget | QtCore.Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_NoSystemBackground, True)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
        
        self.widget = QWidget()
        self.setCentralWidget(self.widget)
        self.widget.setLayout(self.main_layout)
        self.widget.setMouseTracking(True)        
        # self.resize(500,650)
        self.resize(650,650)
        # self.setMaximumHeight(660)
        self.center()

        # 将三个按钮点击信号与相关槽函数相关联
        self.titlebar.min_button.clicked.connect(self.hideIt)
        self.titlebar.max_button.clicked.connect(self.MaxAndNormal)
        self.titlebar.close_button.clicked.connect(self.closeIt)

        # 状态栏进度条:将LoadProgress信号与loading槽函数相关联
        self.WebView.loadProgress.connect(self.loading)

        # notice sound
        # self.player = 

        self.WebView.setHtml(WaitingHTML)
        self.show()
        self.WebView.setStyleSheet("""
            QWebView {
                background-color:black
            }        
#.........这里部分代码省略.........
开发者ID:xin053,项目名称:DrrrClient,代码行数:103,代码来源:DrrrChatRoom.py

示例3: Ui_MainWindow

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setStyleSheet [as 别名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(913, 971)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(3)
        sizePolicy.setVerticalStretch(33)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        MainWindow.setAutoFillBackground(True)
        MainWindow.setStyleSheet("")
        MainWindow.setAnimated(True)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.centralWidget)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.tabWidget_PGMS = QtWidgets.QTabWidget(self.centralWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(20)
        sizePolicy.setVerticalStretch(44)
        sizePolicy.setHeightForWidth(self.tabWidget_PGMS.sizePolicy().hasHeightForWidth())
        self.tabWidget_PGMS.setSizePolicy(sizePolicy)
        self.tabWidget_PGMS.setMinimumSize(QtCore.QSize(800, 700))
        self.tabWidget_PGMS.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.tabWidget_PGMS.setAutoFillBackground(True)
        self.tabWidget_PGMS.setStyleSheet("")
        self.tabWidget_PGMS.setTabBarAutoHide(True)
        self.tabWidget_PGMS.setObjectName("tabWidget_PGMS")
        self.tab_Combination = QtWidgets.QWidget()
        self.tab_Combination.setObjectName("tab_Combination")
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.tab_Combination)
        self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.scrollArea_3 = QtWidgets.QScrollArea(self.tab_Combination)
        self.scrollArea_3.setWidgetResizable(True)
        self.scrollArea_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.scrollArea_3.setObjectName("scrollArea_3")
        self.scrollAreaWidgetContents_3 = QtWidgets.QWidget()
        self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 852, 958))
        self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3")
        self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_3)
        self.verticalLayout_8.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_8.setObjectName("verticalLayout_8")
        self.verticalLayout_6 = QtWidgets.QVBoxLayout()
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.verticalLayout_7 = QtWidgets.QVBoxLayout()
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.label_7 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        self.label_7.setText("")
        self.label_7.setObjectName("label_7")
        self.verticalLayout_7.addWidget(self.label_7)
        self.label_10 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
        self.label_10.setSizePolicy(sizePolicy)
        self.label_10.setObjectName("label_10")
        self.verticalLayout_7.addWidget(self.label_10)
        self.label_11 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        self.label_11.setObjectName("label_11")
        self.verticalLayout_7.addWidget(self.label_11)
        self.label_12 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        self.label_12.setObjectName("label_12")
        self.verticalLayout_7.addWidget(self.label_12)
        self.horizontalLayout_3.addLayout(self.verticalLayout_7)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.horizontalLayout_3.addItem(spacerItem1)
        self.gridLayout_5 = QtWidgets.QGridLayout()
        self.gridLayout_5.setObjectName("gridLayout_5")
        self.label_8 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        self.label_8.setObjectName("label_8")
        self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1)
        self.label_9 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
        self.label_9.setObjectName("label_9")
        self.gridLayout_5.addWidget(self.label_9, 0, 1, 1, 1)
        self.doubleSpinBox_returns_min = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.doubleSpinBox_returns_min.sizePolicy().hasHeightForWidth())
        self.doubleSpinBox_returns_min.setSizePolicy(sizePolicy)
        self.doubleSpinBox_returns_min.setMaximum(0.3)
        self.doubleSpinBox_returns_min.setSingleStep(0.01)
        self.doubleSpinBox_returns_min.setProperty("value", 0.0)
        self.doubleSpinBox_returns_min.setObjectName("doubleSpinBox_returns_min")
        self.gridLayout_5.addWidget(self.doubleSpinBox_returns_min, 1, 0, 1, 1)
        self.doubleSpinBox_returns_max = QtWidgets.QDoubleSpinBox(self.scrollAreaWidgetContents_3)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.doubleSpinBox_returns_max.sizePolicy().hasHeightForWidth())
        self.doubleSpinBox_returns_max.setSizePolicy(sizePolicy)
        self.doubleSpinBox_returns_max.setMinimum(0.0)
#.........这里部分代码省略.........
开发者ID:kiorry,项目名称:PYQT,代码行数:103,代码来源:Ui_combination.py


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