当前位置: 首页 > wzjs >正文

域名连接到网站怎么做怎么做业务推广技巧

域名连接到网站怎么做,怎么做业务推广技巧,如何选择网站关键词,wordpress调用文章id1、目的 通过继承QTreeWidget自定义搜索隐藏显示项的功能 2、效果 3、方法 通过使用setItemHidden函数来使项隐藏和显示,只需遍历整个treeWidget,来搜索全部项。 4、源码 a、头文件 #ifndef SEARCHDISPLAYTREEWIDGET_H #define SEARCHDISPLAYTREEW…
1、目的

通过继承QTreeWidget自定义搜索隐藏显示项的功能

2、效果

在这里插入图片描述

3、方法

通过使用setItemHidden函数来使项隐藏和显示,只需遍历整个treeWidget,来搜索全部项。

4、源码
a、头文件
#ifndef SEARCHDISPLAYTREEWIDGET_H
#define SEARCHDISPLAYTREEWIDGET_H#include <QLineEdit>
#include <QTreeWidget>class SearchDisplayTreeWidget : public QTreeWidget {public:SearchDisplayTreeWidget(QWidget *parent = 0);~SearchDisplayTreeWidget();void searchText(const QString &text);private:/*** @brief foreachSearchchildItem* @param searchLower  搜索字符串* @param isAncestorFind 父项或祖先项是否有搜索字符串,有的话子项就不能隐藏* @param parentItem 父项目* @return 所有是否有搜索到字符串*/bool foreachSearchchildItem(const QString &searchLower,const bool &isAncestorFind,QTreeWidgetItem *parentItem);
};#endif  // SEARCHDISPLAYTREEWIDGET_H
b、源文件
#include "searchdisplaytreewidget.h"
SearchDisplayTreeWidget::SearchDisplayTreeWidget(QWidget* parent): QTreeWidget(parent) {}SearchDisplayTreeWidget::~SearchDisplayTreeWidget() {}void SearchDisplayTreeWidget::searchText(const QString& text) {QString searchLower = text.toLower();for (int i = 0; i < this->topLevelItemCount(); i++) {QTreeWidgetItem* item = this->topLevelItem(i);bool isFind = false;for (int j = 0; j < this->columnCount(); j++) {QString textLower = item->text(j).toLower();isFind = textLower.contains(searchLower);if (isFind) break;}bool isFindChild = foreachSearchchildItem(searchLower, isFind, item);if (isFind || isFindChild) {if (isFindChild && !searchLower.isEmpty()) {// 是在子项找到的,展开子项this->setItemExpanded(item, true);} else {this->setItemExpanded(item, false);}this->setItemHidden(item, false);} else {this->setItemHidden(item, true);}}
}bool SearchDisplayTreeWidget::foreachSearchchildItem(const QString& searchLower, const bool& isAncestorFind,QTreeWidgetItem* parentItem) {if (!parentItem) return false;bool retFind = false;for (int i = 0; i < parentItem->childCount(); i++) {QTreeWidgetItem* item = parentItem->child(i);bool isFind = false;for (int j = 0; j < this->columnCount(); j++) {QString textLower = item->text(j).toLower();isFind = textLower.contains(searchLower);if (isFind) break;}bool isFindChild =foreachSearchchildItem(searchLower, isAncestorFind || isFind, item);if (isAncestorFind || isFind || isFindChild) {if (isFindChild && !searchLower.isEmpty()) {// 是在子项找到的,展开子项this->setItemExpanded(item, true);} else {this->setItemExpanded(item, false);}this->setItemHidden(item, false);if (isFind || isFindChild) retFind = retFind || true;} else {this->setItemHidden(item, true);retFind = retFind || false;}}return retFind;
}

点击下载完整代码

对你有用就点个赞👍,以后需要用到就收藏⭐

http://www.dtcms.com/wzjs/243271.html

相关文章:

  • 关于网站建设的简历模板百度seo是啥意思
  • 中文做网站举出最新的网络营销的案例
  • 佛山做网站公司seo网站推广优化就找微源优化
  • 英文集团网站设计建设网站查询访问
  • 在线营销型网站建设seo引擎优化怎么做
  • 互联网技术专业学什么沈阳seo按天计费
  • 公司建网站怎么建搜索指数在线查询
  • 济源网站建设哪家好小程序开发流程详细
  • 如何做移动支付网站百度的网址怎么写
  • 城乡建设厅网站免费ip地址网站
  • c2c有哪些电商平台天津抖音seo
  • 河南省建设信息网站百度咨询电话人工台
  • 潜山做网站上海市人大常委会
  • 涨粉丝1元1000个seo站长查询
  • 找人做网站不算诈骗罪吗免费域名的网站
  • 做网站流程、招工 最新招聘信息
  • 一级a做爰片啪网站怎么自己开发网站
  • 陕西省建设厅三类人员报名网站广东百度seo关键词排名
  • 合肥网站建设新浪营销域名注册管理中心网站
  • 房地产楼盘微信网站建设营销方案搜狗官网
  • 自己做的网站怎么弄到网上视频广告联盟平台
  • wordpress设置网站地图网络营销的背景和意义
  • 电子商务网站建设与管理的实验报告成都seo技术
  • 手机网站怎么做单页面搜索引擎营销广告
  • 服装网站建设公司有哪些现在如何进行网上推广
  • 毕设如何做网站怎么申请域名建立网站
  • 全部游戏免费(试玩)不用下载专业的网站优化公司
  • 廊坊网站专业制作站内优化
  • 企业官方网站开发外包互联网营销培训班
  • 如何建设一个苹果网站百度广告位价格表