QtableWidget:如何在特定列中查找值
QtableWidget: How to find value in specific column
本文关键字:查找 QtableWidget 更新时间:2023-10-16
我需要使用qtablewidget检查特定值是否在特定列中。在我的情况下,我需要检查第一列ID是否已经存在,如果是,我需要包含行的编号来更新此行,否则我想添加该行。QT是否提供任何解决方案来检查柱或寿
我假设您在第一列中查找值(这就是为什么项(int,int)中的第二个参数为0),表名为myQTableWidget
int rows = myQTableWidget->rowCount();
bool found = false;
for(int i = 0; i < rows; ++i)
{
if(myQTableWidget->item(i, 0)->text() == "Something")
{
//we have found our value so we can update 'i' row
found = true;
break;
}
}
if(!found)
{
//we didn't find our value, so we can insert row
}
相关文章:
- 正在查找文档以获得PS4平台的C++中的设备信息
- 在C++中查找文件
- 模板元程序查找相似的连续类型名称
- 在UNIX系统中使用DIR查找文件的字节大小
- 查找最接近的大于当前数字的数字的索引
- 有没有一种方法可以创建一个带有哈希表的数据库,该哈希表具有恒定时间查找功能
- 查找后更改类变量
- 使用正则表达式regex_search在字符串中查找字符串
- 使用gcc从静态链接的文件中查找可选符号
- 在C++中查找范围的长度
- 算法问题:查找从堆栈中弹出的所有序列
- 在Windows中查找扬声器输出的当前音量级别
- 如何在C++中使用X509证书模在令牌中查找私钥
- 使用.find函数在c++中查找字符和另一个字符之间的大小
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 在 for 循环中查找问题时遇到困难
- 如何在文件中查找字节序列
- 试图创建一个多线程程序来查找0-100000000之间的总素数
- 使用堆查找第K个最大元素的时间复杂性
- QtableWidget:如何在特定列中查找值