我在 QVariantList
中有一个 SKU(SKU - 库存单位)列表。
有没有办法搜索列表并从列表中获取数据?
例如,我想在列表中搜索“sku 0001”并获取 SKU 的关联标题。
谢谢
最佳答案
使用来自 <QtAlgorithms>
的 qFind
例如:
QVariantList vl;
vl << 42 <<"hello"<<3.1415;
QVariantList::const_iterator v = qFind(vl,42);
int iv = (*v).toInt();
++v;
QString sv = (*v).toString();
关于c++ - 搜索 QVariantList?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14083134/