diff options
author | Michele Calgaro <[email protected]> | 2024-07-07 13:06:00 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2024-07-07 13:06:00 +0900 |
commit | 628b0bb74c3fc327efff8add9c73ada04b1cbea2 (patch) | |
tree | 16062922d35b5e0153b9f866e440f36603bd4f55 /doc/dnd.doc | |
parent | 7552c6d73043b1040139033f6864db48ae5446cf (diff) | |
download | tqt3-628b0bb74c3fc327efff8add9c73ada04b1cbea2.tar.gz tqt3-628b0bb74c3fc327efff8add9c73ada04b1cbea2.zip |
Rename drag-n-drop nt* related files to equivalent tq*
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'doc/dnd.doc')
-rw-r--r-- | doc/dnd.doc | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/doc/dnd.doc b/doc/dnd.doc index fe210fd4f..086f4ce76 100644 --- a/doc/dnd.doc +++ b/doc/dnd.doc @@ -58,7 +58,7 @@ TQTextEdit widget source code. \section1 Dragging To start a drag, for example in a \link TQWidget::mouseMoveEvent() -mouse motion event\endlink, create an object of the QDragObject +mouse motion event\endlink, create an object of the TQDragObject subclass appropriate for your media, such as TQTextDrag for text and TQImageDrag for images. Then call the drag() method. This is all you need for simple dragging of existing types. @@ -67,14 +67,14 @@ For example, to start dragging some text from a widget: \code void MyWidget::startDrag() { - QDragObject *d = new TQTextDrag( myHighlightedText(), this ); + TQDragObject *d = new TQTextDrag( myHighlightedText(), this ); d->dragCopy(); // do NOT delete d. } \endcode -Note that the QDragObject is not deleted after the drag. The -QDragObject needs to persist after the drag is apparently finished +Note that the TQDragObject is not deleted after the drag. The +TQDragObject needs to persist after the drag is apparently finished since it may still be communicating with another process. Eventually Qt will delete the object. If the widget owning the drag object is deleted before then, any pending drop will be canceled and the drag @@ -103,7 +103,7 @@ MyWidget::MyWidget(...) : setAcceptDrops(TRUE); } -void MyWidget::dragEnterEvent(QDragEnterEvent* event) +void MyWidget::dragEnterEvent(TQDragEnterEvent* event) { event->accept( TQTextDrag::canDecode(event) || @@ -111,7 +111,7 @@ void MyWidget::dragEnterEvent(QDragEnterEvent* event) ); } -void MyWidget::dropEvent(QDropEvent* event) +void MyWidget::dropEvent(TQDropEvent* event) { TQImage image; TQString text; @@ -126,14 +126,14 @@ void MyWidget::dropEvent(QDropEvent* event) \section1 The Clipboard -The QDragObject, QDragEnterEvent, QDragMoveEvent, and QDropEvent -classes are all subclasses of QMimeSource: the class of objects which +The TQDragObject, TQDragEnterEvent, TQDragMoveEvent, and TQDropEvent +classes are all subclasses of TQMimeSource: the class of objects which provide typed information. If you base your data transfers on -QDragObject, you not only get drag-and-drop, but you also get +TQDragObject, you not only get drag-and-drop, but you also get traditional cut-and-paste for free. The QClipboard has two functions: \code - setData(QMimeSource*) - QMimeSource* data()const + setData(TQMimeSource*) + TQMimeSource* data()const \endcode With these functions you can trivially put your drag-and-drop oriented information on the clipboard: @@ -151,8 +151,8 @@ void MyWidget::paste() insertText( text ); } \endcode -You can even use QDragObject subclasses as part of file IO. For -example, if your application has a subclass of QDragObject that +You can even use TQDragObject subclasses as part of file IO. For +example, if your application has a subclass of TQDragObject that encodes CAD designs in DXF format, your saving and loading code might be: \code @@ -178,7 +178,7 @@ void MyWidget::load() } } \endcode -Note how the QDragObject subclass is called "MyCadDrag", not +Note how the TQDragObject subclass is called "MyCadDrag", not "MyDxfDrag": because in the future you might extend it to provide DXF, DWG, SVF, WMF, or even QPicture data to other applications. @@ -186,7 +186,7 @@ DXF, DWG, SVF, WMF, or even QPicture data to other applications. In the simpler cases, the target of a drag-and-drop receives a copy of the data being dragged and the source decides whether to delete the -original. This is the "Copy" action in QDropEvent. The target may also +original. This is the "Copy" action in TQDropEvent. The target may also choose to understand other actions, specifically the Move and Link actions. If the target understands the Move action, \e{the target} is responsible for both the copy and delete operations and @@ -215,12 +215,12 @@ which of those it can accept. For example, TQTextDrag provides support for the "\c{text/plain}" MIME type (ordinary unformatted text), and the Unicode formats "\c{text/utf16}" and "\c{text/utf8}"; TQImageDrag provides for "\c{image/*}", where \c{*} is any image format that -\l TQImageIO supports; and the QUriDrag subclass provides +\l TQImageIO supports; and the TQUriDrag subclass provides "\c{text/uri-list}", a standard format for transferring a list of filenames (or URLs). To implement drag-and-drop of some type of information for which there -is no available QDragObject subclass, the first and most important +is no available TQDragObject subclass, the first and most important step is to look for existing formats that are appropriate: the Internet Assigned Numbers Authority (\link http://www.iana.org IANA\endlink) provides a \link @@ -230,31 +230,31 @@ list of MIME media types\endlink at the Information Sciences Institute maximizes the inter-operability of your application with other software now and in the future. -To support an additional media type, subclass either QDragObject or -QStoredDrag. Subclass QDragObject when you need to provide support for -multiple media types. Subclass the simpler QStoredDrag when one type +To support an additional media type, subclass either TQDragObject or +TQStoredDrag. Subclass TQDragObject when you need to provide support for +multiple media types. Subclass the simpler TQStoredDrag when one type is sufficient. -Subclasses of QDragObject will override the -\link QDragObject::format() +Subclasses of TQDragObject will override the +\link TQDragObject::format() const char* format(int i) const \endlink and -\link QDragObject::encodedData() +\link TQDragObject::encodedData() QByteArray encodedData(const char* mimetype) const \endlink members, and provide a set-method to encode the media data and static members canDecode() and decode() to decode incoming data, similar to \link TQImageDrag::canDecode() -bool canDecode(QMimeSource*) const +bool canDecode(TQMimeSource*) const \endlink and \link TQImageDrag::decode() -QByteArray decode(QMimeSource*) const +QByteArray decode(TQMimeSource*) const \endlink of TQImageDrag. Of course, you can provide drag-only or drop-only support for a media type by omitting some of these methods. -Subclasses of QStoredDrag provide a set-method to encode the media +Subclasses of TQStoredDrag provide a set-method to encode the media data and the same static members canDecode() and decode() to decode incoming data. @@ -276,17 +276,17 @@ the drag start point and the drop event might look like this: \code void MyEditor::startDrag() { - QDragObject *d = new TQTextDrag(myHighlightedText(), this); + TQDragObject *d = new TQTextDrag(myHighlightedText(), this); if ( d->drag() && d->target() != this ) cutMyHighlightedText(); } -void MyEditor::dropEvent(QDropEvent* event) +void MyEditor::dropEvent(TQDropEvent* event) { TQString text; if ( TQTextDrag::decode(event, text) ) { - if ( event->source() == this && event->action() == QDropEvent::Move ) { + if ( event->source() == this && event->action() == TQDropEvent::Move ) { // Careful not to tread on my own feet event->acceptAction(); moveMyHighlightedTextTo(event->pos()); @@ -303,7 +303,7 @@ accept drops of text onto text objects in the view. In these cases, the \link TQWidget::dragMoveEvent() dragMoveEvent()\endlink is used and an \e area is given for which the drag is accepted or ignored: \code -void MyWidget::dragMoveEvent(QDragMoveEvent* event) +void MyWidget::dragMoveEvent(TQDragMoveEvent* event) { if ( TQTextDrag::canDecode(event) ) { MyCadItem* item = findMyItemAt(event->pos()); @@ -316,7 +316,7 @@ If the computations to find objects are particularly slow, you might achieve improved performance if you tell the system an area for which you promise the acceptance persists: \code -void MyWidget::dragMoveEvent(QDragMoveEvent* event) +void MyWidget::dragMoveEvent(TQDragMoveEvent* event) { if ( TQTextDrag::canDecode(event) ) { MyCadItem* item = findMyItemAt(event->pos()); |