[Qt-interest] Target Item reference in dropEvent of QListWidget?
David Boosalis
david.boosalis at gmail.com
Wed Aug 5 00:13:44 CEST 2009
Here is how I look for the item dropped on. Hope it helps.
void MyTreeWidget::dropEvent(QDropEvent *event)
{
QStringList strList;
QString str;
bool okay;
const QMimeData *mimeData;
QTreeWidgetItem *item;
QVariant variant;
int itemType;
selectedItem = 0;
QPoint pos = event->pos();
item = itemAt(pos);
if(item) {
variant = item->data(0,Qt::UserRole);
itemType = variant.toInt(&okay);
...
}
...
}
On Tue, Aug 4, 2009 at 1:42 PM, Kurt Barlow<kurt.barlow at gmail.com> wrote:
> Hi,
>
> I have a QListWidget that I have configured to do what I need (Nice and
> Easy). I add QListWidgetItems to it and specify with flags that these items
> can accept drop events (QtCore.Qt.ItemIsDropEnabled).
> I overwrite the drop event and make sure I let the QListWidget handle the
> details ...
>
> def dropEvent(self, event):
>
> QtGui.QListWidget.dropEvent(
> self, event)
> # How can I get a reference to the target item from here?
>
> The problem is that I need to know which row the item that is being dropped
> onto is in (target item). QListWidgetItem has no events for me to overwrite
> so subclassing it did not help me. Any ideas?
>
> Thanks
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
More information about the Qt-interest-old
mailing list