Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQIconDrag Class Reference
[iconview module]

The TQIconDrag class supports drag and drop operations within a TQIconView. More...

#include <tqiconview.h>

Inherits TQDragObject.

List of all member functions.

Public Members

Static Public Members


Detailed Description

The TQIconDrag class supports drag and drop operations within a TQIconView.

A TQIconDrag object is used to maintain information about the positions of dragged items and the data associated with the dragged items. TQIconViews are able to use this information to paint the dragged items in the correct positions. Internally TQIconDrag stores the data associated with drag items in TQIconDragItem objects.

If you want to use the extended drag-and-drop functionality of TQIconView, create a TQIconDrag object in a reimplementation of TQIconView::dragObject(). Then create a TQIconDragItem for each item which should be dragged, set the data it represents with TQIconDragItem::setData(), and add each TQIconDragItem to the drag object using append().

The data in TQIconDragItems is stored in a TQByteArray and is mime-typed (see TQMimeSource and the Drag and Drop overview). If you want to use your own mime-types derive a class from TQIconDrag and reimplement format(), encodedData() and canDecode().

The fileiconview example program demonstrates the use of the TQIconDrag class including subclassing and reimplementing dragObject(), format(), encodedData() and canDecode(). See the files qt/examples/fileiconview/tqfileiconview.h and qt/examples/fileiconview/tqfileiconview.cpp.

See also TQMimeSource::format() and Drag And Drop Classes.


Member Function Documentation

TQIconDrag::TQIconDrag ( TQWidget * dragSource, const char * name = 0 )

Constructs a drag object called name, which is a child of dragSource.

Note that the drag object will be deleted when dragSource is deleted.

TQIconDrag::~TQIconDrag () [virtual]

Destructor.

void TQIconDrag::append ( const TQIconDragItem & i, const TQRect & pr, const TQRect & tr )

Append the TQIconDragItem, i, to the TQIconDrag object's list of items. You must also supply the geometry of the pixmap, pr, and the textual caption, tr.

See also TQIconDragItem.

Example: fileiconview/tqfileiconview.cpp.

bool TQIconDrag::canDecode ( TQMimeSource * e ) [static]

Returns TRUE if e can be decoded by the TQIconDrag, otherwise return FALSE.

Example: fileiconview/tqfileiconview.cpp.

TQByteArray TQIconDrag::encodedData ( const char * mime ) const [virtual]

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

Example: fileiconview/tqfileiconview.cpp.

Reimplemented from TQMimeSource.


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8