[Closed] QListView: How to move QDrag::pixmap along Y-axis keeping x as constant (Drag and Drop)
-
I am working on a listView and have overridden the following functions:
@void mousePressEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
void startDrag(Qt::DropActions supportedActions);@In the startDrag() function I have written:
@void MyListView::startDrag(Qt::DropActions supportedActions)
{
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);ListWidgetItem *item = static_cast<ListWidgetItem *>(childAt(dragPoint)); dataStream << dragPoint; QMimeData *mimeData = new QMimeData; mimeData->setData("application/x-QListView-DragAndDrop", itemData); drag = new QDrag(this); qDebug() << drag; drag->setMimeData(mimeData); drag->setHotSpot(mapToParent(QPoint(item->x(),y))); drag->setPixmap(currentPixmap); QModelIndex indx = indexAt(dragPoint); if (drag->exec(Qt::MoveAction | Qt::CopyAction) == Qt::MoveAction) { model()->removeRow(indx.row()); }
}@
Here I have used drag->setHotSpot() which places the QDrag::pixmap() at a particulat position while dragging.
I am trying to change the HotSpot position in dragMoveEvent() but it does not change.How can I allow the QDrag::pixmap() to move only along the y-axis keeping x as constant ?
Thanks
Edit:
Thanks for the concerns, I hope to get an update on either of the cases :)
-
Please don't ask the "same question":http://qt-project.org/forums/viewthread/20627/ twice.
Edit:
I have asked the other moderators to look into this one. They may or may not re-open this topic.