0
我在使用PySide(Python版本3.2.5)在QLabel中顯示功能超鏈接到網頁的功能超鏈接。從這個帖子c++ - Making QLabel behave like a hyperlink - Stack Overflow閱讀最upvoted答案,我的印象是,這將工作:使用PySide鏈接到QLabel中的網頁
from PySide.QtCore import Qt
from PySide.QtGui import QApplication, QLabel
app = QApplication([])
window = QLabel()
window.setText("<a href=\"http://stackoverflow.com/\" />Stack Overflow</a>")
window.setTextFormat(Qt.RichText)
window.setTextInteractionFlags(Qt.TextBrowserInteraction)
window.setOpenExternalLinks(True)
window.show()
app.exec_()
遺憾的是,文本不顯示爲一個鏈接。任何人都可以請我指出正確的方向?
在這個例子中,''標籤已經自動關閉了,所以沒有鏈接文本。 – ekhumoro 2014-09-14 16:51:41
是的;不知道這是怎麼發生的,我以爲我只是複製粘貼標籤...對不起,這個打擾你。 – user1919235 2014-09-16 00:00:38