The Q3IconDrag class supports drag and drop operations within a Q3IconView . 更多...
| 头: | #include <Q3IconDrag> |
| 继承: | Q3DragObject |
| Q3IconDrag (QWidget * dragSource , const char * name = 0) | |
| virtual | ~Q3IconDrag () |
| void | append (const Q3IconDragItem & i , const QRect & pr , const QRect & tr ) |
| virtual QByteArray | encodedData (const char * mime ) const |
| virtual const char * | format (int i ) const |
| bool | canDecode (QMimeSource * e ) |
The Q3IconDrag class supports drag and drop operations within a Q3IconView .
A Q3IconDrag object is used to maintain information about the positions of dragged items and the data associated with them. Q3IconViews are able to use this information to paint the dragged items in the correct positions. Internally, Q3IconDrag stores the data associated with drag items in Q3IconDragItem 对象。
If you want to use the extended drag and drop functionality of Q3IconView , create a Q3IconDrag object in a reimplementation of Q3IconView::dragObject ()。然后创建 Q3IconDragItem for each item which should be dragged, set the data it represents with Q3IconDragItem::setData (), and add each Q3IconDragItem to the drag object using append ().
The data in Q3IconDragItems is stored in a QByteArray and is mime-typed (see QMimeSource and the 拖放 overview). If you want to use your own mime-types derive a class from Q3IconDrag 并重实现 format (), encodedData () 和 canDecode ().
The fileiconview example program demonstrates the use of the Q3IconDrag class including subclassing and reimplementing dragObject(), format (), encodedData () 和 canDecode ().
另请参阅 QMimeSource::format ().
Constructs a drag object called name , which is a child of dragSource .
Note that the drag object will be deleted when dragSource 被删除。
[虚拟]
Q3IconDrag::
~Q3IconDrag
()
析构函数。
Append the Q3IconDragItem , i ,到 Q3IconDrag object's list of items. You must also supply the geometry of the pixmap, pr , and the textual caption, tr .
另请参阅 Q3IconDragItem .
[static]
bool
Q3IconDrag::
canDecode
(
QMimeSource
*
e
)
返回 true 若 e can be decoded by the Q3IconDrag , otherwise return false.
[虚拟]
QByteArray
Q3IconDrag::
encodedData
(const
char
*
mime
) const
重实现自 QMimeSource::encodedData ().
Returns the encoded data of the drag object if mime is application/x-qiconlist.
[虚拟]
const
char
* Q3IconDrag::
format
(
int
i
) const
重实现自 QMimeSource::format ().