久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='2pCvA'></small><noframes id='2pCvA'>

    1. <i id='2pCvA'><tr id='2pCvA'><dt id='2pCvA'><q id='2pCvA'><span id='2pCvA'><b id='2pCvA'><form id='2pCvA'><ins id='2pCvA'></ins><ul id='2pCvA'></ul><sub id='2pCvA'></sub></form><legend id='2pCvA'></legend><bdo id='2pCvA'><pre id='2pCvA'><center id='2pCvA'></center></pre></bdo></b><th id='2pCvA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2pCvA'><tfoot id='2pCvA'></tfoot><dl id='2pCvA'><fieldset id='2pCvA'></fieldset></dl></div>
      <tfoot id='2pCvA'></tfoot>
        <legend id='2pCvA'><style id='2pCvA'><dir id='2pCvA'><q id='2pCvA'></q></dir></style></legend>
          <bdo id='2pCvA'></bdo><ul id='2pCvA'></ul>

        如何使用 target=“_blank"打開超鏈接在 PyQtWeb

        How to open hyperlink with target=quot;_blankquot; in PyQtWebEngine?(如何使用 target=“_blank打開超鏈接在 PyQtWebEngine 中?)
            <tbody id='Qyib9'></tbody>

          <tfoot id='Qyib9'></tfoot>

          <small id='Qyib9'></small><noframes id='Qyib9'>

          <i id='Qyib9'><tr id='Qyib9'><dt id='Qyib9'><q id='Qyib9'><span id='Qyib9'><b id='Qyib9'><form id='Qyib9'><ins id='Qyib9'></ins><ul id='Qyib9'></ul><sub id='Qyib9'></sub></form><legend id='Qyib9'></legend><bdo id='Qyib9'><pre id='Qyib9'><center id='Qyib9'></center></pre></bdo></b><th id='Qyib9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qyib9'><tfoot id='Qyib9'></tfoot><dl id='Qyib9'><fieldset id='Qyib9'></fieldset></dl></div>

            1. <legend id='Qyib9'><style id='Qyib9'><dir id='Qyib9'><q id='Qyib9'></q></dir></style></legend>
              • <bdo id='Qyib9'></bdo><ul id='Qyib9'></ul>
                • 本文介紹了如何使用 target=“_blank"打開超鏈接在 PyQtWebEngine 中?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我使用 pyqt5 和 PyQtWebEngine 制作了一個 Web 瀏覽器.它工作正常,但是當我單擊帶有 target=_blank"的超鏈接時那么它不起作用,但我將如何解決它.您可以通過點擊此鏈接查看其源代碼 https://github.com/SaptakBhoumik/WebPlus.請檢查我的代碼并告訴我該怎么做

                  I have made a web browser using pyqt5 and PyQtWebEngine.It works fine but when I click on a hyperlink with target="_blank" then it does not work but how will I fix it. You can view its source code by clicking on this link https://github.com/SaptakBhoumik/WebPlus . Please review my code and tell me what to do

                  推薦答案

                  如 文檔:

                  _blank:通常是一個新標簽頁,但用戶可以配置瀏覽器打開一個新窗口.

                  _blank: usually a new tab, but users can configure browsers to open a new window instead.

                  也就是說,目標不是重新加載頁面,而是創建一個新選項卡,然后為了獲得該請求,您必須重寫 QWebEngineView(或 QWebEnginePage)的 createWindow 方法:

                  That is, the objective is not to reload the page but to create a new tab, and then to obtain that request you must override the createWindow method of QWebEngineView (or QWebEnginePage):

                  from functools import cached_property
                  import sys
                  
                  
                  from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
                  
                  
                  class WebView(QtWebEngineWidgets.QWebEngineView):
                      def createWindow(self, type_):
                          if not isinstance(self.window(), Browser):
                              return
                  
                          if type_ == QtWebEngineWidgets.QWebEnginePage.WebBrowserTab:
                              return self.window().tab_widget.create_tab()
                  
                  
                  class TabWidget(QtWidgets.QTabWidget):
                      def create_tab(self):
                          view = WebView()
                  
                          index = self.addTab(view, "(Untitled)")
                          self.setTabIcon(index, view.icon())
                          view.titleChanged.connect(
                              lambda title, view=view: self.update_title(view, title)
                          )
                          view.iconChanged.connect(lambda icon, view=view: self.update_icon(view, icon))
                          self.setCurrentWidget(view)
                          return view
                  
                      def update_title(self, view, title):
                          index = self.indexOf(view)
                          self.setTabText(index, title)
                  
                      def update_icon(self, view, icon):
                          index = self.indexOf(view)
                          self.setTabIcon(index, icon)
                  
                  
                  class Browser(QtWidgets.QMainWindow):
                      def __init__(self, parent=None):
                          super().__init__(parent)
                          self.setCentralWidget(self.tab_widget)
                  
                          view = self.tab_widget.create_tab()
                          view.load(
                              QtCore.QUrl(
                                  "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_a_target"
                              )
                          )
                  
                      @cached_property
                      def tab_widget(self):
                          return TabWidget()
                  
                  
                  def main():
                      app = QtWidgets.QApplication(sys.argv)
                      w = Browser()
                      w.show()
                      sys.exit(app.exec_())
                  
                  
                  if __name__ == "__main__":
                      main()
                  

                  注意:建議您查看官方示例:WebEngine Widgets 簡單瀏覽器示例,以及在 PySide2 很容易翻譯成 PyQt5 實現了這個功能和更多功能.

                  Note: I recommend that you review the official example: WebEngine Widgets Simple Browser Example, in addition to its implementation in PySide2 which is easily translatable to PyQt5 where this feature and many more are implemented.

                  這篇關于如何使用 target=“_blank"打開超鏈接在 PyQtWebEngine 中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                      <i id='YLUc0'><tr id='YLUc0'><dt id='YLUc0'><q id='YLUc0'><span id='YLUc0'><b id='YLUc0'><form id='YLUc0'><ins id='YLUc0'></ins><ul id='YLUc0'></ul><sub id='YLUc0'></sub></form><legend id='YLUc0'></legend><bdo id='YLUc0'><pre id='YLUc0'><center id='YLUc0'></center></pre></bdo></b><th id='YLUc0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YLUc0'><tfoot id='YLUc0'></tfoot><dl id='YLUc0'><fieldset id='YLUc0'></fieldset></dl></div>

                        <tbody id='YLUc0'></tbody>
                        <bdo id='YLUc0'></bdo><ul id='YLUc0'></ul>

                      • <tfoot id='YLUc0'></tfoot>

                            <small id='YLUc0'></small><noframes id='YLUc0'>

                            <legend id='YLUc0'><style id='YLUc0'><dir id='YLUc0'><q id='YLUc0'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 成人免费视频观看视频 | 国内福利视频 | 欧美成人午夜 | 一区二区三区四区在线 | 激情婷婷网 | 亚洲国产第一页 | 黄色天天影视 | 国产视频一区二区在线播放 | 人人爱人人澡 | 成人精品| 国产成人三级在线观看 | 亚洲激情第一页 | 久久久久久久综合 | 久久人人爽人人爽人人片 | 亚洲成人av| 黄色片一级| 久草综合网 | 亚洲国产片| 国产区视频在线观看 | 91国内精品 | 欧美97 | 香蕉视频导航 | 国产理论在线 | 四虎黄色影院 | 日韩中文字幕在线播放 | 中文字幕永久在线 | 天天插天天插 | 国产激情网站 | 中文字幕永久在线 | 欧美午夜视频 | 麻豆av网站| 国产一区免费 | 色综合五月 | 白浆在线 | 中文字幕丰满人伦在线 | 国产免费一级 | 色人人| 国产日韩精品一区二区 | 风间由美一区二区三区 | 亚洲国产成人精品女人久久久 | 一本在线 |