我有一个类似的代码:
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时使用:
然后您可以检查:
相关问题 更多 >
编程相关推荐