Hrm, I couldn't find any neat way to do that.
One way I found:
class Something ...
{
...
private slots:
void itemEditDone();
private:
...
};
class Something ...
{
...
private slots:
void setEditItem(QTreeWidgetItem* item);
void itemEditDone();
private:
QTreeWidget* m_tree;
QTreeWidgetItem* m_item;
...
};
To copy to clipboard, switch view to plain text mode
this, SLOT(itemEditDone()));
connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
this, SLOT(setEditItem(QTreeWidgetItem*)));
connect(m_tree->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
this, SLOT(itemEditDone()));
To copy to clipboard, switch view to plain text mode
{
// keep track of the changing item
// this gets called when items are eg. added, not only when edited...
m_item = item;
}
void Something::itemEditDone()
{
// this gets called when the actual editing is done
// currentItem() does not workie here so that's why
// keeping track of changing items :p
qDebug() << m_item->text(0);
}
void Something::setEditItem(QTreeWidgetItem* item)
{
// keep track of the changing item
// this gets called when items are eg. added, not only when edited...
m_item = item;
}
void Something::itemEditDone()
{
// this gets called when the actual editing is done
// currentItem() does not workie here so that's why
// keeping track of changing items :p
qDebug() << m_item->text(0);
}
To copy to clipboard, switch view to plain text mode
Bookmarks