Eneboo - Documentación para desarrolladores
|
The QDropEvent class provides an event which is sent when a drag and drop is completed. Más...
#include <qevent.h>
Tipos públicos | |
enum | Action { Copy, Link, Move, Private, UserAction = 100, Copy, Link, Move, Private, UserAction = 100 } |
enum | Action { Copy, Link, Move, Private, UserAction = 100, Copy, Link, Move, Private, UserAction = 100 } |
Métodos públicos | |
QDropEvent (const QPoint &pos, Type typ=Drop) | |
const QPoint & | pos () const |
bool | isAccepted () const |
void | accept (bool y=TRUE) |
void | ignore () |
bool | isActionAccepted () const |
void | acceptAction (bool y=TRUE) |
void | setAction (Action a) |
Action | action () const |
QWidget * | source () const |
const char * | format (int n=0) const |
QByteArray | encodedData (const char *) const |
bool | provides (const char *) const |
QByteArray | data (const char *f) const |
void | setPoint (const QPoint &np) |
QDropEvent (const QPoint &pos, Type typ=Drop) | |
const QPoint & | pos () const |
bool | isAccepted () const |
void | accept (bool y=TRUE) |
void | ignore () |
bool | isActionAccepted () const |
void | acceptAction (bool y=TRUE) |
void | setAction (Action a) |
Action | action () const |
QWidget * | source () const |
const char * | format (int n=0) const |
QByteArray | encodedData (const char *) const |
bool | provides (const char *) const |
QByteArray | data (const char *f) const |
void | setPoint (const QPoint &np) |
Atributos protegidos | |
QPoint | p |
uint | act:8 |
uint | accpt:1 |
uint | accptact:1 |
uint | resv:5 |
void * | d |
The QDropEvent class provides an event which is sent when a drag and drop is completed.
When a widget accepts drop events, it will receive this event if it has accepted the most recent QDragEnterEvent or QDragMoveEvent sent to it.
The widget should use data() to extract the data in an appropriate format.
enum QDropEvent::Action |
This enum describes the action which a source requests that a target perform with dropped data.
Copy The default action. The source simply uses the data provided in the operation. Link The source should somehow create a link to the location specified by the data. Move The source should somehow move the object from the location specified by the data to a new location. Private The target has special knowledge of the MIME type, which the source should respond to in a similar way to a Copy. UserAction The source and target can co-operate using special actions. This feature is not currently supported.
The Link and Move actions only makes sense if the data is a reference, for example, text/uri-list file lists (see QUriDrag).
enum QDropEvent::Action |
Constructs a drop event that drops a drop of type typ on point pos.
void QDropEvent::accept | ( | bool | y = TRUE | ) | [inline] |
Call this function to indicate whether the event provided data which your widget processed. Set y to TRUE (the default) if your widget could process the data, otherwise set y to FALSE. To get the data, use encodedData(), or preferably, the decode() methods of existing QDragObject subclasses, such as QTextDrag::decode(), or your own subclasses.
Reimplementado en QDragMoveEvent y QDragMoveEvent.
void QDropEvent::accept | ( | bool | y = TRUE | ) | [inline] |
Reimplementado en QDragMoveEvent y QDragMoveEvent.
void QDropEvent::acceptAction | ( | bool | y = TRUE | ) | [inline] |
void QDropEvent::acceptAction | ( | bool | y = TRUE | ) | [inline] |
Call this to indicate that the action described by action() is accepted (i.e. if y is TRUE, which is the default), not merely the default copy action. If you call acceptAction(TRUE), there is no need to also call accept(TRUE).
Action QDropEvent::action | ( | ) | const [inline] |
Returns the Action which the target is requesting to be performed with the data. If your application understands the action and can process the supplied data, call acceptAction(); if your application can process the supplied data but can only perform the Copy action, call accept().
Action QDropEvent::action | ( | ) | const [inline] |
QByteArray QDropEvent::data | ( | const char * | f | ) | const [inline] |
QByteArray QDropEvent::data | ( | const char * | f | ) | const [inline] |
QByteArray QDropEvent::encodedData | ( | const char * | format | ) | const [virtual] |
Returns a byte array containing the drag's data, in format.
data() normally needs to get the data from the drag source, which is potentially very slow, so it's advisable to call this function only if you're sure that you will need the data in format.
The resulting data will have a size of 0 if the format was not available.
Implementa QMimeSource.
QByteArray QDropEvent::encodedData | ( | const char * | ) | const [virtual] |
Returns the encoded data of this object in the specified MIME format.
Subclasses must reimplement this function.
Implementa QMimeSource.
const char* QDropEvent::format | ( | int | i = 0 | ) | const [virtual] |
Returns the {i}-th supported MIME format, or 0.
Implementa QMimeSource.
const char * QDropEvent::format | ( | int | n = 0 | ) | const [virtual] |
Returns a string describing one of the available data types for this drag. Common examples are "text/plain" and "image/gif". If n is less than zero or greater than the number of available data types, format() returns 0.
This function is provided mainly for debugging. Most drop targets will use provides().
Implementa QMimeSource.
void QDropEvent::ignore | ( | ) | [inline] |
The opposite of accept(), i.e. you have ignored the drop event.
Reimplementado en QDragMoveEvent y QDragMoveEvent.
void QDropEvent::ignore | ( | ) | [inline] |
Reimplementado en QDragMoveEvent y QDragMoveEvent.
bool QDropEvent::isAccepted | ( | ) | const [inline] |
bool QDropEvent::isAccepted | ( | ) | const [inline] |
Returns TRUE if the drop target accepts the event; otherwise returns FALSE.
bool QDropEvent::isActionAccepted | ( | ) | const [inline] |
bool QDropEvent::isActionAccepted | ( | ) | const [inline] |
Returns TRUE if the drop action was accepted by the drop site; otherwise returns FALSE.
const QPoint & QDropEvent::pos | ( | ) | const [inline] |
Returns the position where the drop was made.
const QPoint& QDropEvent::pos | ( | ) | const [inline] |
bool QDropEvent::provides | ( | const char * | mimeType | ) | const [virtual] |
Returns TRUE if the object can provide the data in format mimeType; otherwise returns FALSE.
If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as QTextDrag::canDecode() and QImageDrag::canDecode().
Reimplementado de QMimeSource.
bool QDropEvent::provides | ( | const char * | mimeType | ) | const [virtual] |
Returns TRUE if this event provides format mimeType; otherwise returns FALSE.
Reimplementado de QMimeSource.
void QDropEvent::setAction | ( | Action | a | ) | [inline] |
Sets the action to a. This is used internally, you should not need to call this in your code: the source decides the action, not the target.
void QDropEvent::setAction | ( | Action | a | ) | [inline] |
void QDropEvent::setPoint | ( | const QPoint & | np | ) | [inline] |
void QDropEvent::setPoint | ( | const QPoint & | np | ) | [inline] |
Sets the drop to happen at point np. You do not normally need to use this as it will be set internally before your widget receives the drop event.
QWidget* QDropEvent::source | ( | ) | const |
QWidget* QDropEvent::source | ( | ) | const |
uint QDropEvent::accpt [protected] |
uint QDropEvent::accptact [protected] |
uint QDropEvent::act [protected] |
void * QDropEvent::d [protected] |
QPoint QDropEvent::p [protected] |
uint QDropEvent::resv [protected] |