当前位置:网站首页>On traversal of tree nodes
On traversal of tree nodes
2022-06-27 15:08:00 【Master Hao】
Be careful ,lamda expression , If you use [=], At the moment of generation , The internal corresponding global variable is converted to a local variable , Will not be active with the global .
bool flagUseForSentryPost=_sentryPostIDShown==""?false:true;
// Flag used to mark whether to turn on the keyword filtering of sentinel name :
bool falgUseForFilterQString=!txt.isEmpty();
// Used to determine whether it is a sentry box node :
auto isSentryPost=[=](QTreeWidgetItemIterator item){return (*item)->text(2)=="sentrypost"?true:false;};
// Used to determine whether it is a camera node :
auto isCamera=[=](QTreeWidgetItemIterator item){return (*item)->text(1)=="camera"?true:false;};
// Used to determine whether it is an organization node :
auto isOrg=[=](QTreeWidgetItemIterator item){return (*item)->text(2)=="org"?true:false;};
QTreeWidgetItemIterator it(this);
// If the filter specifies a sentinel :
if(flagUseForSentryPost)
{
// All hidden at first :
while(*it)
{
(*it)->setHidden(true);
it++;
}
// Set the iterator pointer to the header
it=QTreeWidgetItemIterator(this);
while(*it)
{
// If the current node is a sentinel node and conforms to id requirement
if(isSentryPost(it)&&_sentryPostIDShown==(*it)->text(5))
{
// Show all its parent nodes
(*it)->setHidden(false);
this->parentVisible(*it);
// Then display all its child nodes :
for(int i=0;i<(*it)->childCount();i++)
{
(*it)->child(i)->setHidden(false);
}
}
it++;
}
}
else// Do not filter the designated sentry to display all directly
{
while(*it)
{
(*it)->setHidden(false);
it++;
}
}
// Add text filter below : If the sentinel name filter is started :
if(falgUseForFilterQString)
{
// Traverse multiple current display nodes
it=QTreeWidgetItemIterator(this,QTreeWidgetItemIterator::IteratorFlag::NotHidden);
QString str;
while(*it)
{
str=(*it)->text(0);
// If the node contains the specified name :
if(str.indexOf(txt)!=-1)
{
// Show all its parent nodes
this->parentVisible(*it);
}
else// Hide this node
{
(*it)->setHidden(true);
}
it++;
}
}
边栏推荐
- Pisa-Proxy 之 SQL 解析实践
- AQS抽象队列同步器
- Redis master-slave replication, sentinel mode, cluster cluster
- Programming skills: script scheduling
- 海量数据!秒级分析!Flink+Doris构建实时数仓方案
- [an Xun cup 2019]attack
- Privacy computing fat offline prediction
- Professor huangxutao, a great master in CV field, was born at the age of 86. UIUC specially set up a doctoral scholarship to encourage cutting-edge students
- LVI: feature extraction and sorting of lidar subsystem
- Leetcode 724. 寻找数组的中心下标(可以,一次过)
猜你喜欢
![[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities](/img/19/9827a5e8becfc9d5bf2f51bddf803e.png)
[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities

Teach you how to package and release the mofish Library
![[digital signal processing] discrete time signal (analog signal, discrete time signal, digital signal | sampling leads to time discrete | quantization leads to amplitude discrete)](/img/80/28d53985d56d64ca721b26e846c667.jpg)
[digital signal processing] discrete time signal (analog signal, discrete time signal, digital signal | sampling leads to time discrete | quantization leads to amplitude discrete)

Redis master-slave replication, sentinel mode, cluster cluster

ReentrantLock、ReentrantReadWriteLock、StampedLock

海量数据!秒级分析!Flink+Doris构建实时数仓方案

Use GCC to generate an abstract syntax tree "ast" and dump it to Dot file and visualization

All you want to know about large screen visualization is here

In the past, domestic mobile phones were arrogant in pricing and threatened that consumers would like to buy or not, but now they have plummeted by 2000 for sale

The global chip market may stagnate, and China's chip expansion accelerates to improve its self-sufficiency rate against the trend
随机推荐
Practice of constructing ten billion relationship knowledge map based on Nebula graph
[an Xun cup 2019]attack
LVI: feature extraction and sorting of lidar subsystem
Using redis skillfully to realize the like function, isn't it more fragrant than MySQL?
External memory
About the meaning of the first two $symbols of SAP ui5 parameter $$updategroupid
易周金融 | Q1手机银行活跃用户规模6.5亿;理财子公司布局新兴领域
我想买固收+产品,但是不了解它主要投资哪些方面,有人知道吗?
[business security 03] password retrieval business security and interface parameter account modification examples (based on the metinfov4.0 platform)
【微服务|Sentinel】热点规则|授权规则|集群流控|机器列表
Pisa-Proxy 之 SQL 解析实践
Leetcode 724. Find the central subscript of the array (yes, once)
[advanced mathematics] from normal vector to surface integral of the second kind
Fundamentals of software engineering (I)
Synchronized与锁升级
Naacl 2022 | TAMT: search the transportable Bert subnet through downstream task independent mask training
[WUSTCTF2020]girlfriend
Maximum profit of stock (offer 63)
QT notes (XXVIII) using qwebengineview to display web pages
Use GCC to generate an abstract syntax tree "ast" and dump it to Dot file and visualization