Qt Toolkit - QIconDrag Class

| Classes - Annotated - Tree - Functions - Home - Structure

# QIconDrag Class Reference
[ iconview module ]

The QIconDrag class is the drag object which is used for moving items in the iconview More...

`#include <qiconview.h>`

Inherits QDragObject.

List of all member functions.

## Public Members

- virtual ~QIconDrag ()
- void append ( const QIconDragItem & item, const QRect & pr, const QRect & tr )
- virtual QByteArray encodedData ( const char * mime ) const

## Static Public Members

- bool canDecode ( QMimeSource * e )

## Detailed Description

The QIconDrag class is the drag object which is used for moving items in the iconview

The QIconDrag is the drag object which is used for moving items in the iconview. The QIconDrag stores exact informations about the positions of the items, which are dragged, so that each iconview is able to draw drag shapes in correct positions. Also the data of each dragged item is stored here.

If you want to use extended DnD functionality of the QIconView, normally it's enough to just create a QIconDrag object in QIconView::dragObject(). Then create for each item which should be dragged a QIconDragItem and set the data it represents with QIconDragItem::setData() and add this item to the drag object using append().

If you want to offer the data in other mime-types too, derive a class from this and implement the needed encoding and decoding here.

An example, how to implement this, is in the QtFileIconView example (qt/examples/qfileiconview/qfileiconview.h and qt/examples/qfileiconview/qfileiconview.cpp).

## Member Function Documentation

### QIconDrag::QIconDrag ( QWidget * dragSource, const char * name = 0 )

Reimplemented for internal reasons; the API is not affected.

### QIconDrag::~QIconDrag () `[virtual]`

Destructor.

### void QIconDrag::append ( const QIconDragItem & i, const QRect & pr, const QRect & tr )

Appends an icon drag item which should be stored in this dragobject and the geometry of it.

See also QIconDragItem.

### bool QIconDrag::canDecode ( QMimeSource * e ) `[static]`

Returns TRUE if e can be decoded by the QIconDrag, else FALSE.

### QByteArray QIconDrag::encodedData ( const char * mime ) const `[virtual]`

Returns the encoded data of the drag object if mime is application/x-qiconlist.

### const char* QIconDrag::format ( int i ) const `[virtual]`

Reimplemented for internal reasons; the API is not affected.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.