QT Create 学习之 QTreeWidget--新建节点及样式设置

int num = ui->m_List->topLevelItemCount();

当前有多少顶层项,即列表中的第一级目录


item = ui->m_faultList->topLevelItem(k);

指向索引为 k 的第一级目录



item->text(0)

获取该级节点的文字,表示第一列



item = new QTreeWidgetItem(ui->m_List, node_item_name);

node_item_name 为节点名,QStringList 类型,只有一列的话,直接用QString转换即可



QTreeWidget::item{  
    /*margin:13px;  
    background: #5B677A;  
    background-clip: margin; */
    font-size:15px;  
    color: white;
}  

设置字体,尺寸即颜色



QTreeWidget{  
    /*background-color: #5B677A;  
 
     set the font properties*/  
    font-size:15px;  
    color: white;  
}

设置字体,尺寸即颜色



ScrollArea 设置成 OFF,即可关闭滑动条。

猜你喜欢

转载自blog.csdn.net/u010477528/article/details/78299947