[英]How to find a row in a QStandardItemModel
I have a QStandardItemModel with 8 columns. 我有一个8列的QStandardItemModel。 I'm looking for a way to get the number of the row containing a specific word in the first column to update it.
我正在寻找一种方法来获取第一列中包含特定单词的行号以对其进行更新。
I can made a for
loop to scan all rows, but I think it's the worst thing to do, concerning the performances. 我可以创建一个
for
循环来扫描所有行,但是就性能而言,我认为这是最糟糕的事情。
Any idea ? 任何想法 ? Thanks
谢谢
Just use a QMap<QString, int>
with QString = the word to search and int = the row where it's stored. 只需使用
QMap<QString, int>
其中QString =要搜索的单词,而int =存储该单词的行。
Thanks @bruno @drescherjm 谢谢@bruno @drescherjm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.