How can we find out the index (i.e both row and column numbers) of a cell containing a QString in a QTableView using QT c++?
(P.S.:Without clicking on the cell in qtableview)
How can we find out the index (i.e both row and column numbers) of a cell containing a QString in a QTableView using QT c++?
(P.S.:Without clicking on the cell in qtableview)
You can use
findItems()
function to find your cell.findItems()
function returns a list of items that match the given text, using the given flags, in the given column.If you want to get index of found item and highlight it use this code:
More info:
QTableView: The
QTableView
class provides a default model/view implementation of a table view.QStandardItemModel: The
QStandardItemModel
class provides a generic model for storing custom data.