使用到QTreeWidget做總結,以便下次使用。
QTreeWidget CalibrationWidget = new QTreeWidget;
CalibrationWidget->setColumnCount(2); //将treewidget設定為兩列
CalibrationWidget->setColumnWidth(0, 155); //設定指定列寬
CalibrationWidget->setItemsExpandable(true); //設定預設為展開
QStringList m_header;
m_header
QStringList dynamic;
dynamic<
1、删除所有子清單項
QListQTreeWidgetItem::takeChildren() //删除所有子清單項
Removes the list of children and returns it, otherwise returns an empty list.
2、删除指定子清單項
void QTreeWidgetItem::removeChild(QTreeWidgetItem * child) //删除指定子清單項
Removes the given item indicated by child. The removed item will not be deleted.
3、删除指定索引的子清單項
QTreeWidgetItem * QTreeWidgetItem::takeChild(int index) //删除指定索引的子清單項
Removes the item at index and returns it, otherwise return 0.
4、添加子清單項
void QTreeWidgetItem::addChild(QTreeWidgetItem * child) //添加子清單項
Appends the child item to the list of children.
5、添加多條子清單項
void QTreeWidgetItem::addChildren(const QList& children) //添加多條子清單項
Appends the given list of children to the item.
6、設定treewidget字型樣式及treewidget頭字型樣式
QTreeWidget->setFont(QFont("微軟雅黑", 12, QFont::Normal, false));
QTreeWidget->headerItem()->setFont(0, QFont("微軟雅黑", 12, QFont::Normal, false));//設定treewidget頭字型格式