Class Qt.ItemFlag
This enum describes the properties of an item. Note that checkable items need to be given both a suitable set of flags and an initial state, indicating whether the item is checked or not. This is handled automatically for model/view components, but needs to be explicitly set for instances of QTableWidgetItem.
in this case I will use(for all items set flag):
Qt::ItemIsSelectable - It can be selected.
self.dlg.tableWidget.setRowCount(3)
self.dlg.tableWidget.setColumnCount(4)
self.dlg.tableWidget.horizontalHeader().sectionPressed.disconnect() # disconnect horizontal header
data = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
for row in range(3): # add items from array to QTableWidget
for column in range(4):
item = QTableWidgetItem(str(data[row][column])) # each item is a QTableWidgetItem
item.setFlags(Qt.ItemIsSelectable) # set flag to the item
self.dlg.tableWidget.setItem(row, column, item)

NOTE: the row will be selected just if you click on the verticalHeader