Qt logo

QIconDragItem Class Reference


The QIconDragItem is the internal data structure of a QIconDrag More...

#include <qiconview.h>

List of all member functions.

Public Members

Protected Members


Detailed Description

The QIconDragItem is the internal data structure of a QIconDrag

This class is used internally in the QIconDrag to store the data (in fact, a list of QIconDragItems is used by QIconDrag). Such an item stores the data about the geometry of an item of the iconview which is dragged around, so that drag shapes can be drawn correctly.

If you extend the DnD functionality of a QIconView, you should use a class derived from QIconDrag as dragobject. This class again should contain a list of objects which are derived from this class.

So, normally for each iconview item which is dragged, a QIconDragItem class (or a class derived from QIconDragItem) is created and stored in the QIconDrag object.

So, in a class derived from that you should reimplement QIconDragItem::makeKey(), so that a key containing the data of this object + the geometry of the dragged item is created and returned.

You also may add methods to add/get the data you store 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

QIconDragItem::QIconDragItem ()

Constructs and empty QIconDragItem.

QIconDragItem::QIconDragItem ( const QRect & ir, const QRect & tr )

Constructs and QIconDragItem. ir is the icon rectangle and tr the bounding rectangle of the icon text.

QIconDragItem::~QIconDragItem () [virtual]

Destructor.

QString QIconDragItem::key () const [virtual]

Returns the key of this item.

void QIconDragItem::makeKey () [virtual protected]

Generates a unique key which describes this item.

bool QIconDragItem::operator< ( const QIconDragItem & icon ) const [virtual]

Returns TRUE if icon is smaller than this item, else FALSE.

bool QIconDragItem::operator== ( const QIconDragItem & icon ) const [virtual]

Returns TRUE if icon is equal to this item.

QRect QIconDragItem::pixmapRect () const [virtual]

Returns the bounding rectangle of the icon which data is stored in this item.

void QIconDragItem::setPixmapRect ( const QRect & r ) [virtual]

Sets r as the rectangle of the icon.

void QIconDragItem::setTextRect ( const QRect & r ) [virtual]

Sets r as the rectangle of the text.

QRect QIconDragItem::textRect () const [virtual]

Returns the bounding rectangle of the text of the icon which data is stored in this item.


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


This file is part of the Qt toolkit, copyright © 1995-2000 Troll Tech, all rights reserved.


Copyright İ 2000 Troll TechTrademarks
Qt version 2.1.0 (pre-release)