Q3TextDrag Class

The Q3TextDrag class is a drag and drop object for transferring plain and Unicode text. 更多...

頭: #include <Q3TextDrag>
繼承: Q3DragObject

公共函數

Q3TextDrag (const QString & text , QWidget * dragSource = 0, const char * name = 0)
Q3TextDrag (QWidget * dragSource = 0, const char * name = 0)
~Q3TextDrag ()
virtual void setSubtype (const QString & subtype )
virtual void setText (const QString & text )

重實現公共函數

virtual QByteArray encodedData (const char * mime ) const
virtual const char * format (int i ) const

靜態公共成員

bool canDecode (const QMimeSource * source )
bool decode (const QMimeSource * source , QString & string )
bool decode (const QMimeSource * source , QString & string , QString & subtype )

額外繼承成員

詳細描述

The Q3TextDrag class is a drag and drop object for transferring plain and Unicode text.

Plain text is passed in a QString which may contain multiple lines (i.e. may contain newline characters). The drag target will receive the newlines according to the runtime environment, e.g. LF on Unix, and CRLF on Windows.

Qt provides no built-in mechanism for delivering only a single-line.

For more information about drag and drop, see the Q3DragObject 類和 drag and drop documentation .

成員函數文檔編製

Q3TextDrag:: Q3TextDrag (const QString & text , QWidget * dragSource = 0, const char * name = 0)

Constructs a text drag object with the given name , and sets its data to text dragSource is the widget that the drag operation started from.

Q3TextDrag:: Q3TextDrag ( QWidget * dragSource = 0, const char * name = 0)

Constructs a default text drag object with the given name dragSource is the widget that the drag operation started from.

Q3TextDrag:: ~Q3TextDrag ()

Destroys the text drag object.

[static] bool Q3TextDrag:: canDecode (const QMimeSource * source )

Returns true if the information in the MIME source can be decoded into a QString ;否則返迴 false。

另請參閱 decode ().

[static] bool Q3TextDrag:: decode (const QMimeSource * source , QString & string )

Attempts to decode the dropped information in the MIME source string given. Returns true if successful; otherwise returns false.

另請參閱 canDecode ().

[static] bool Q3TextDrag:: decode (const QMimeSource * source , QString & string , QString & subtype )

這是重載函數。

Attempts to decode the dropped information in the MIME source string given. Returns true if successful; otherwise returns false. If subtype is null, any text subtype is accepted; otherwise only the specified subtype is accepted.

另請參閱 canDecode ().

[虛擬] QByteArray Q3TextDrag:: encodedData (const char * mime ) const

重實現自 QMimeSource::encodedData ().

[虛擬] const char * Q3TextDrag:: format ( int i ) const

重實現自 QMimeSource::format ().

[虛擬] void Q3TextDrag:: setSubtype (const QString & subtype )

Sets the MIME subtype of the text being dragged. The default subtype is "plain", so the default MIME type of the text is "text/plain". You might use this to declare that the text is "text/html" by calling setSubtype("html").

[虛擬] void Q3TextDrag:: setText (const QString & text )

設置 text to be dragged. You will need to call this if you did not pass the text during construction.