Source Code (Use browser search to find items of interest.)
Class Index
qt'QDropEvent (./qt-2.1.0/src/kernel/qevent.h:316)
class Q_EXPORT QDropEvent : public QEvent, public QMimeSource
{
public:
QDropEvent( const QPoint& pos, Type typ=Drop )
: QEvent(typ), p(pos),
act(0), accpt(0), accptact(0), resv(0),
d(0)
{}
const QPoint &pos() const { return p; }
bool isAccepted() const { return accpt || accptact; }
void accept(bool y=TRUE) { accpt = y; }
void ignore() { accpt = FALSE; }
bool isActionAccepted() const { return accptact; }
void acceptAction(bool y=TRUE) { accptact = y; }
enum Action { Copy, Link, Move, Private, UserAction=100 };
void setAction( Action a ) { act = (uint)a; }
Action action() const { return Action(act); }
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 { return encodedData(f); }
void setPoint( const QPoint& np ) { p = np; }
protected:
QPoint p;
uint act:8;
uint accpt:1;
uint accptact:1;
uint resv:5;
void * d;
};
qt'QDropEvent::xdndaction_to_qtaction() (./qt-2.1.0/src/kernel/qdnd_x11.cpp:108)
QDropEvent::Action xdndaction_to_qtaction(Atom atom)
{
if ( atom == qt_xdnd_action_copy || atom == 0 )
return QDropEvent::Copy;
if ( atom == qt_xdnd_action_link )
return QDropEvent::Link;
if ( atom == qt_xdnd_action_move )
return QDropEvent::Move;
return QDropEvent::Private;
}
static
qt'QDropEvent::provides() (./qt-2.1.0/src/kernel/qdnd_x11.cpp:1305)
bool QDropEvent::provides( const char *mimeType ) const
{
if ( qt_motifdnd_active ) {
if ( 0 == qstrnicmp( mimeType, "text/", 5 ) )
return TRUE;
else
return FALSE;
}
int n=0;
const char* f;
do {
f = format( n );
if ( !f )
return FALSE;
n++;
} while( qstricmp( mimeType, f ) );
return TRUE;
}
qt'QDropEvent::encodedData() (./qt-2.1.0/src/kernel/qdnd_x11.cpp:1489)
QByteArray QDropEvent::encodedData( const char *format ) const
{
if ( qt_motifdnd_active )
return qt_motifdnd_obtain_data();
return qt_xdnd_obtain_data( format );
}
/*! Returns a string describing one of the available data types for
this drag. Common examples are "text/plain" and "image/gif". If \a
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().
\sa data() provides()
*/
qt'QDropEvent::format() (./qt-2.1.0/src/kernel/qdnd_x11.cpp:1507)
const char* QDropEvent::format( int n ) const
{
if ( qt_motifdnd_active ) {
if ( n == 0 )
return "text/plain";
else if ( n == 1 )
return "text/uri-list";
else
return 0;
}
int i = 0;
while( i<n && qt_xdnd_types[i] )
i++;
if ( i < n )
return 0;
const char* name = qt_xdnd_atom_to_str( qt_xdnd_types[i] );
if ( !name )
return 0; // should never happen
return name;
}
qt'QDropEvent::source() (./qt-2.1.0/src/kernel/qdragobject.cpp:1307)
QWidget* QDropEvent::source() const
{
return manager ? manager->dragSource : 0;
}
/*! \class QColorDrag qdragobject.h
\brief The QColorDrag provides a drag-and-drop object for
transferring colors.
\ingroup draganddrop
This class provides a drag object which can be used to transfere
data about colors for drag-and-drop and over the clipboard. It's
e.g. used in the QColorDialog.
For detailed information about drag-and-drop, see the QDragObject class.
*/
/*!
Constructs a color drag with the color \a col.
*/