Here is how I am doing that in my program:
## Creates New Chat Tab
def newChatTab(self, tabLabel):
self.chatTabs[tabLabel] = ViewDock()
QtCore.
QObject.
connect(self.
chatTabs[tabLabel
].
viewPage,
QtCore.SIGNAL('linkClicked(const QUrl&)'), self.linkClicked)
QtCore.
QObject.
connect(self.
chatTabs[tabLabel
].
viewPage,
QtCore.SIGNAL('linkHovered(const QString&, const QString&, const QString&)'),
self.parent.StatusBar)
self.chatView.addTab(self.chatTabs[tabLabel], tabLabel)
## Creates New Chat Tab
def newChatTab(self, tabLabel):
self.chatTabs[tabLabel] = ViewDock()
QtCore.QObject.connect(self.chatTabs[tabLabel].viewPage,
QtCore.SIGNAL('linkClicked(const QUrl&)'), self.linkClicked)
QtCore.QObject.connect(self.chatTabs[tabLabel].viewPage,
QtCore.SIGNAL('linkHovered(const QString&, const QString&, const QString&)'),
self.parent.StatusBar)
self.chatView.addTab(self.chatTabs[tabLabel], tabLabel)
To copy to clipboard, switch view to plain text mode
The ViewDock() calls a widget that I dock into the tab that has been created, and the connections are for URL links. One connection is linked to a function that creates a new tab for an in house browser, and the other connection sends the URL of the link hovered over to the status bar.
Anytime i need a new tab I can just call self.newChatTab("Tab Name") and I will make a new tab with the string being passed.
Bookmarks