PDA

View Full Version : QListWidget - reordering



ComServant
21st August 2010, 21:38
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 )
{
QModelIndex oldIndex = item->index();
QStandardItemModel::setItem(row, column, item);
QModelIndex newIndex = item->index();

emit: customSignal(oldIndex, newIndex);
}

Or am I going about it the wrong way?

ComServant
24th August 2010, 19:03
Well, nevermind. Couldn't figure it out, but I changed the way my objects are moved anyway, so it's not needed anymore.

Thanks anyway.