QTreeWidgetItem封装

#include "qtreewighthelper.h"

QTreeWidgetItem* AddQTreeWidgetItemChild(QTreeWidgetItem* parentSource, QString childSource, QIcon iconSource, int type)
{
QTreeWidgetItem *itemEngineeringInformation = new QTreeWidgetItem(parentSource, QStringList(QString(childSource)), type); //子节点1
itemEngineeringInformation->setIcon(0, iconSource);
parentSource->addChild(itemEngineeringInformation); //添加子节点
return itemEngineeringInformation;
}

void IconSelected(QAction* source,bool isSelected)
{
if (isSelected)
{
source->setIcon(QIcon("picture/Menus/SelectionIcon.png"));
}
else
{
source->setIcon(QIcon("picture/Menus/UnSelectionIcon.png"));
}

}

 

转载于:https://www.cnblogs.com/ShiShouTHS/p/11083886.html

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页