Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     super(AladinLiteQtWidget, self).__init__(*args, **kwargs)
     web = QWebEngineView()
     web.setHtml(ALADIN_LITE_HTML)
     layout = QVBoxLayout()
     self.setLayout(layout)
     layout.addWidget(web)
     self.page = web.page()
Esempio n. 2
0
@Slot(str)
def linkHovered(hoveredLink):
    print(hoveredLink)
    # alternatively, run an alert box
    # page.runJavaScript("alert(\""+hoveredLink+"\")")


def urlChanged(qulr):
    print("url changed to: ")
    print(qulr)


app = QApplication([])

view = QWebEngineView()
page = view.page()

view.loadStarted.connect(print("loadStarted"))
view.loadProgress.connect(print("loadProgress"))
view.loadFinished.connect(finishLoading)
view.titleChanged.connect(titleChanged)

page.selectionChanged.connect(selectionChanged)
page.linkHovered.connect(linkHovered)
page.urlChanged.connect(urlChanged)

# content in unicode html format - Content larger than 2 MB cannot be displayed
html = "<h1>Heading</h1><p>paragraph</p><p><a href=\"https://marvel.bible\"><img src='marvel.png' alt='Marvel.Bible icon'></a></p>"

# External objects, such as stylesheets or images referenced in the HTML document, are located RELATIVE TO baseUrl .
# e.g. put all local files linked by html's content in folder "htmlResources"