Actually, I have different tabs, what I wanted to achieve - the user has a link from tab 1 Clicked - and it will be displayed in tab 2 immediately in tab 2, I set the HTML anchor.
Is there a way to do this?
I have managed to switch tabs using tabWidget.setCurrentWidget () Now the question is how to set the focus of QTextBrowser to the desired HTML anchor.
In advance thanks
Here's an example:
Tabwidget import from Ui_MainWindow import sys, PyQt4 import QtGui, QtCore class MyApp (QtGui.QMainWindow): def __init __ (self, original = none): QtGui.QWidget .__ init __ (self, parent) self. Ui = Ui_MainWindow () self.ui.setupUi (self) QtCore QObject.connect (self.ui.pushButton, QtCore.SIGNAL ('clicked'), self._show) def _show (self): self.ui.tabWidget .setCurrentWidget (self.ui.tab_2) self.ui.textBrowser .setSource (QtCore.QUrl ('text.html # anchor')) If __name__ == "__m Ain__": app = QtGui.QApplication (sys.argv) mw = MyApp () mw.show () app. Exec_ ()
Comments
Post a Comment