我有一个类似于此的代码:
class A(QWebView):
def __init__(self):
# some code here
# in here I want to check what url is loaded and based on that assign appropriate SLOT
# I was wondering how to do something like that:
# if 'examle.html' in self.url():
# self.loadFinished.connect(self.example)
# else:
# self.loadFinished.connect(self.anotherSLOT)
if __name__ == '__main__':
app = QApplication(sys.argv)
br = A()
br.load(QUrl('http://example')
br.show()
app.exec_()
我有一种感觉,我做的完全错了。理想情况下,我想加载两个 url 并将其连接到适当的插槽,但现在我只想出了这种解决方案。