Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, April 2008
Drag and Drop in QListWidget


Message 1 in thread

Hi,

I am trying to implement some drag and drop functionality in QListWidget.
When the drag is over I want to know which QListWidgetItem was dragged.

The "source" method supported by QDropEvent class returns the "QWidget *" .
Instead what I am looking for is "QListWidgetItem *" that was dragged. I
tried casting  QWidget to QListWidgetItem  but the compiler gave error.

I can use pos() but it would make the code complicated. Is there something
straight forward to do this?

I am using QT 4.3.3 on WinXP.

Thanks,
Andy

Message 2 in thread

Hi,

Why you don't use QListWidget's drag drop functions?

Such as
setDragDropMode <http://doc.trolltech.com/4.1/qlistwidget-members.html> (
DragDropMode )
setDragDropOverwriteMode<http://doc.trolltech.com/4.1/qlistwidget-members.html>(
bool )
setDragEnabled <http://doc.trolltech.com/4.1/qlistwidget-members.html> (
bool )
setDropIndicatorShown<http://doc.trolltech.com/4.1/qlistwidget-members.html>(
bool )

Best regards,
Aram.
On Wed, Apr 2, 2008 at 8:37 PM, Andy Gynn <andy.gynn@xxxxxxxxx> wrote:

> Hi,
>
> I am trying to implement some drag and drop functionality in QListWidget.
> When the drag is over I want to know which QListWidgetItem was dragged.
>
> The "source" method supported by QDropEvent class returns the "QWidget *"
> . Instead what I am looking for is "QListWidgetItem *" that was dragged. I
> tried casting  QWidget to QListWidgetItem  but the compiler gave error.
>
> I can use pos() but it would make the code complicated. Is there something
> straight forward to do this?
>
> I am using QT 4.3.3 on WinXP.
>
> Thanks,
> Andy




-- 
 [ signature omitted ] 

Message 3 in thread

Hi All,
I'm trying to do the same thing, but with Qt version 4.1.2.  In that 
version we don't have the very nice option to
'setDragDropMode'.
Right now I can drag the list widget items around, but when I drop them 
I'm not sure how to tell where they've been
dropped.   Any suggestions?
(I'm just trying to have a list that the user can re-order by dragging 
and dropping items into the order they like.)

Thanks,
Stacy

Aram Antonyan wrote:
> Hi,
>  
> Why you don't use QListWidget's drag drop functions?
>  
> Such as
> setDragDropMode 
> <http://doc.trolltech.com/4.1/qlistwidget-members.html> ( DragDropMode )
> setDragDropOverwriteMode 
> <http://doc.trolltech.com/4.1/qlistwidget-members.html> ( bool )
> setDragEnabled <http://doc.trolltech.com/4.1/qlistwidget-members.html> 
> ( bool )
> setDropIndicatorShown 
> <http://doc.trolltech.com/4.1/qlistwidget-members.html> ( bool )
>  
> Best regards,
> Aram.
> On Wed, Apr 2, 2008 at 8:37 PM, Andy Gynn <andy.gynn@xxxxxxxxx 
> <mailto:andy.gynn@xxxxxxxxx>> wrote:
>
>     Hi,
>
>     I am trying to implement some drag and drop functionality in
>     QListWidget. When the drag is over I want to know which
>     QListWidgetItem was dragged.
>
>     The "source" method supported by QDropEvent class returns the
>     "QWidget *" . Instead what I am looking for is "QListWidgetItem *"
>     that was dragged. I tried casting  QWidget to QListWidgetItem  but
>     the compiler gave error.
>
>     I can use pos() but it would make the code complicated. Is there
>     something straight forward to do this?
>
>     I am using QT 4.3.3 on WinXP.
>
>     Thanks,
>     Andy 
>
>
>
>
> -- 
> Best regards,
> Aram. 

-- 
 [ signature omitted ]