I have a QListWidget. How can I know when a item in it gets moved, and how can I know where it gets moved to? (It only gets moved inside of the QListWidget, not outside of it. I'd like the index that it gets moved to)
Is there some signal that does it? Like: itemMoved(index previous, index current)
[Edit:]
Or, if not, what do I need to watch for, in QStandardItemModel, to implement such a signal myself? I'm new to QT's Model/View system.
Should I reimplement QStandardItemModel::setItem(), like this:
MyReimplementedStandardItemModel
::setItem(int row,
int column,
QStandardItem * item
){
emit: customSignal(oldIndex, newIndex);
}
MyReimplementedStandardItemModel::setItem(int row, int column, QStandardItem * item )
{
QModelIndex oldIndex = item->index();
QStandardItemModel::setItem(row, column, item);
QModelIndex newIndex = item->index();
emit: customSignal(oldIndex, newIndex);
}
To copy to clipboard, switch view to plain text mode
Or am I going about it the wrong way?
Bookmarks