QTreeWidgetItem swap or move up one level problem
I have build a tool to manage xml tree categories on infinite level but now...
i like insert a function to move up item or swap item ...
My question... exist a similar function from QTreeWidgetItem to make this?
I can access each QTreeWidgetItem by nummer
http://ppk.ciz.ch/qt_c++/qt/xmltree.png
Code:
void Tree_Category::AppendItemTree()
{
if (Maus_Select_Active) { /* active QTreeWidgetItem */
/*int sotto_totale = Niagara_Actual->childCount();*/
/*niagara->editItem(Niagara_Actual,0);*/
/*qDebug() << "### found 0 " << sotto_totale;*/
bool ok;
if (ok && !SetNewName.isEmpty()) {
watposition++; /* numeration */
newsub->setText(0,xput);
newsub->setToolTip(0,xput);
PutOptionNow(newsub); /* set various option and put to other class qlist */
}
} else {
QMessageBox::warning( this, tr
( "Error" ), tr
( "Select on item please!"));
}
}
Re: QTreeWidgetItem swap or move up one level problem
QTreeWidget doesn't provide such functionality out of the box. This thread contains code example for swapping 2 rows in a QTableWidget. It should be rather straigthforward to adjust for QTreeWidget.
Re: QTreeWidgetItem swap or move up one level problem
i found a solution .....
by loading QTreeWidget and update load all text to a QStringList ....
by move or swap select destination from a combobox QStringList
search the destination text findname .....
Code:
QList<QTreeWidgetItem*> items = niagara->findItems(findname, Qt::MatchRecursive | Qt::MatchExactly , 0);
if (items.count() == 1) {
/* clone source and destination and update source to "findname" ....*/
}
so i can swap item to all level :-) .....