- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
void addItem(QStringList &lst, QTreeWidget *ptwg)
{
bool a0 = false;
for (int i = 0; i < ptwg->topLevelItemCount(); ++i) {
if (lst.at(0) == ptwg->topLevelItem(i)->text(0)) {
a0 = true;
bool a1 = false;
QTreeWidgetItem *itm0 = ptwg->topLevelItem(i);
for (int j = 0; j < itm0->childCount(); ++j) {
if (lst.at(1) == itm0->child(j)->text(1)) {
a1 = true;
bool a2 = false;
QTreeWidgetItem *itm1 = itm0->child(j);
for (int k = 0; k < itm1->childCount(); ++k) {
if (lst.at(2) == itm1->child(k)->text(2)) {
a2 = true;
bool a3 = false;
QTreeWidgetItem *itm2 = itm1->child(k);
for (int l = 0; l < itm2->childCount(); ++l) {
if (lst.at(3) == itm2->child(l)->text(3)) {
a3 = true;
QTreeWidgetItem *itm3 = itm2->child(l);
QTreeWidgetItem *itm4 = new QTreeWidgetItem(itm3, QStringList() << "" << "" << "" << "" << lst.at(4));
break;
}
}
if (!a3) {
QTreeWidgetItem *itm3 = new QTreeWidgetItem(itm2, QStringList() << "" << "" << "" << lst.at(3));
QTreeWidgetItem *itm4 = new QTreeWidgetItem(itm3, QStringList() << "" << "" << "" << "" << lst.at(4));
}
break;
}
}
if (!a2) {
QTreeWidgetItem *itm2 = new QTreeWidgetItem(itm1, QStringList() << "" << "" << lst.at(2));
QTreeWidgetItem *itm3 = new QTreeWidgetItem(itm2, QStringList() << "" << "" << "" << lst.at(3));
QTreeWidgetItem *itm4 = new QTreeWidgetItem(itm3, QStringList() << "" << "" << "" << "" << lst.at(4));
}
break;
}
}
if (!a1) {
QTreeWidgetItem *itm1 = new QTreeWidgetItem(itm0, QStringList() << "" << lst.at(1));
QTreeWidgetItem *itm2 = new QTreeWidgetItem(itm1, QStringList() << "" << "" << lst.at(2));
QTreeWidgetItem *itm3 = new QTreeWidgetItem(itm2, QStringList() << "" << "" << "" << lst.at(3));
QTreeWidgetItem *itm4 = new QTreeWidgetItem(itm3, QStringList() << "" << "" << "" << "" << lst.at(4));
}
break;
}
}
if (!a0) {
QTreeWidgetItem *itm0 = new QTreeWidgetItem(ptwg, QStringList() << lst.at(0));
QTreeWidgetItem *itm1 = new QTreeWidgetItem(itm0, QStringList() << "" << lst.at(1));
QTreeWidgetItem *itm2 = new QTreeWidgetItem(itm1, QStringList() << "" << "" << lst.at(2));
QTreeWidgetItem *itm3 = new QTreeWidgetItem(itm2, QStringList() << "" << "" << "" << lst.at(3));
QTreeWidgetItem *itm4 = new QTreeWidgetItem(itm3, QStringList() << "" << "" << "" << "" << lst.at(4));
}
}
Функция = ) Добавляет в контрол иерархического дерева (5 уровней) элемент, не перерисовывая при этом само дерево, не закрывая никаких открытых веток.
guest 24.03.2010 13:50 # 0
guest 24.03.2010 23:58 # 0
guest 24.03.2010 14:47 # +0.8
нечитаемое говнище.
guest 25.03.2010 11:23 # 0
guest 25.03.2010 18:02 # 0