Reputation: 139
I was wondering if it is possible to double click on a cell in a QTableWidget
(I've already disabled cell editing) and it opening a link in a web browser. I'm using PyQt4 for Python 3.4.2.
Upvotes: 3
Views: 3615
Reputation: 139
self.tableWidget.itemDoubleClicked.connect(self.OpenLink)
def OpenLink(self,item):
if item.column() == 1:
webbrowser.open('www.google.com')
This is how I solved it in my program, item.text() is the text in the cell, item.row() is it's row number and item.column() the column number.
Upvotes: 10
Reputation: 10860
Sure it is possible. You just need to combine two things.
Connect a suitable slot to signal cellDoubleClicked of QTableWidget
.
Tell a browser to display a link using the webbrowser module of Python.
Upvotes: 1