当前位置:网站首页>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++;
}
}
边栏推荐
- Maximum profit of stock (offer 63)
- Computer screen splitting method
- Abnormal analysis of pcf8591 voltage measurement data
- Using redis skillfully to realize the like function, isn't it more fragrant than MySQL?
- ERROR L104: MULTIPLE PUBLIC DEFINITIONS
- About sitemap XML problems
- Use of abortcontroller
- 跨境电商多商户系统怎么选
- 522. longest special sequence II / Sword finger offer II 101 Split equal sum subset
- A brief analysis of the differences between domestic and foreign e-commerce
猜你喜欢

LVI: feature extraction and sorting of lidar subsystem

跨境电商多商户系统怎么选

Design and implementation of food recipe and ingredients website based on vue+node+mysql

Leetcode 724. 寻找数组的中心下标(可以,一次过)

基于SSM的Web网页聊天室系统
![[OS command injection] common OS command execution functions and OS command injection utilization examples and range experiments - based on DVWA range](/img/f2/458770fc74971bef23f96f87733ee5.png)
[OS command injection] common OS command execution functions and OS command injection utilization examples and range experiments - based on DVWA range
Talk about redis transactions

Hyperledger Fabric 2. X custom smart contract

What is the London Silver unit

Pychart installation and setup
随机推荐
[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities
Semaphore of thread synchronization
[an Xun cup 2019]attack
ReentrantLock、ReentrantReadWriteLock、StampedLock
AQS Abstract queue synchronizer
[business security 03] password retrieval business security and interface parameter account modification examples (based on the metinfov4.0 platform)
Google tool splits by specified length
Teach you how to realize pynq-z2 bar code recognition
Vscode uses yapf auto format to set the maximum number of characters per line
Unity3d best practices: folder structure and source control
What are the characteristics of fixed income + products?
About sitemap XML problems
Leetcode 724. 寻找数组的中心下标(可以,一次过)
Redis persistence
我想买固收+产品,但是不了解它主要投资哪些方面,有人知道吗?
élégant pool de threadpoolexecutor personnalisé
Sword finger offer II 039 Histogram maximum rectangular area monotonic stack
ReentrantLock、ReentrantReadWriteLock、StampedLock
老师能给我说一下固收+产品主要投资于哪些方面?
At a time of oversupply of chips, China, the largest importer, continued to reduce imports, and the United States panicked