Qt-interest Archive, February 2007
dropping on on a QListWidget
Message 1 in thread
What do you have to do to get a QListWidget to accept drag enter
events/drops? Shouldn't I just implement supportedDropActions() and
dragEnterEvent? In the following dragEnterEvent is never called...
Qt::DropActions LibraryListWidget::supportedDropActions() const
{
return Qt::ActionMask;
}
void LibraryListWidget::dragEnterEvent(QDragEnterEvent *e)
{
qDebug("enter");
e->accept();
}
thanks
--
[ signature omitted ]
Message 2 in thread
Patrick Stinson wrote:
> What do you have to do to get a QListWidget to accept drag enter
> events/drops? Shouldn't I just implement supportedDropActions() and
> dragEnterEvent? In the following dragEnterEvent is never called...
>
>
> Qt::DropActions LibraryListWidget::supportedDropActions() const
> {
> return Qt::ActionMask;
> }
>
> void LibraryListWidget::dragEnterEvent(QDragEnterEvent *e)
> {
> qDebug("enter");
> e->accept();
> }
>
>
> thanks
>
In constructor, you can set:
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
Then, implement:
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
void startDrag(Qt::DropActions supportedActions);
It should work.
Lingfa
--
[ signature omitted ]
Message 3 in thread
right. that was it.
On 2/9/07, lingfa <lingfa@xxxxxxxxxxxx> wrote:
> Patrick Stinson wrote:
>
> > What do you have to do to get a QListWidget to accept drag enter
> > events/drops? Shouldn't I just implement supportedDropActions() and
> > dragEnterEvent? In the following dragEnterEvent is never called...
> >
> >
> > Qt::DropActions LibraryListWidget::supportedDropActions() const
> > {
> > return Qt::ActionMask;
> > }
> >
> > void LibraryListWidget::dragEnterEvent(QDragEnterEvent *e)
> > {
> > qDebug("enter");
> > e->accept();
> > }
> >
> >
> > thanks
> >
>
> In constructor, you can set:
> setDragEnabled(true);
> setAcceptDrops(true);
> setDropIndicatorShown(true);
>
> Then, implement:
> protected:
> void dragEnterEvent(QDragEnterEvent *event);
> void dragMoveEvent(QDragMoveEvent *event);
> void dropEvent(QDropEvent *event);
> void startDrag(Qt::DropActions supportedActions);
>
> It should work.
>
> Lingfa
>
>
>
--
[ signature omitted ]