diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/dnd.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/dnd.html')
-rw-r--r-- | doc/html/dnd.html | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/doc/html/dnd.html b/doc/html/dnd.html index 16512c0db..82f90aa51 100644 --- a/doc/html/dnd.html +++ b/doc/html/dnd.html @@ -59,10 +59,10 @@ mechanism. <p> For drag and drop examples see (in increasing order of sophistication): <tt>qt/examples/iconview/simple_dd</tt>, <tt>qt/examples/dragdrop</tt> and <tt>qt/examples/fileiconview</tt>. See also the -<a href="qtextedit.html">TQTextEdit</a> widget source code. +<a href="ntqtextedit.html">TQTextEdit</a> widget source code. <p> <h2> Dragging </h2> -<a name="1"></a><p> To start a drag, for example in a <a href="qwidget.html#mouseMoveEvent">mouse motion event</a>, create an object of the <a href="qdragobject.html">TQDragObject</a> +<a name="1"></a><p> To start a drag, for example in a <a href="ntqwidget.html#mouseMoveEvent">mouse motion event</a>, create an object of the <a href="ntqdragobject.html">TQDragObject</a> subclass appropriate for your media, such as <a href="qtextdrag.html">TQTextDrag</a> for text and <a href="qimagedrag.html">TQImageDrag</a> for images. Then call the drag() method. This is all you need for simple dragging of existing types. @@ -70,8 +70,8 @@ need for simple dragging of existing types. <pre> void MyWidget::startDrag() { - <a href="qdragobject.html">TQDragObject</a> *d = new <a href="qtextdrag.html">TQTextDrag</a>( myHighlightedText(), this ); - d-><a href="qdragobject.html#dragCopy">dragCopy</a>(); + <a href="ntqdragobject.html">TQDragObject</a> *d = new <a href="qtextdrag.html">TQTextDrag</a>( myHighlightedText(), this ); + d-><a href="ntqdragobject.html#dragCopy">dragCopy</a>(); // do NOT delete d. } </pre> @@ -86,19 +86,19 @@ references. <p> <h2> Dropping </h2> <a name="2"></a><p> To be able to receive media dropped on a widget, call -<a href="qwidget.html#setAcceptDrops">setAcceptDrops(TRUE)</a> +<a href="ntqwidget.html#setAcceptDrops">setAcceptDrops(TRUE)</a> for the widget (e.g. in its constructor), and override the event handler methods -<a href="qwidget.html#dragEnterEvent">dragEnterEvent()</a> and -<a href="qwidget.html#dropEvent">dropEvent()</a>. +<a href="ntqwidget.html#dragEnterEvent">dragEnterEvent()</a> and +<a href="ntqwidget.html#dropEvent">dropEvent()</a>. For more sophisticated applications overriding -<a href="qwidget.html#dragMoveEvent">dragMoveEvent()</a> and -<a href="qwidget.html#dragLeaveEvent">dragLeaveEvent()</a> will also be +<a href="ntqwidget.html#dragMoveEvent">dragMoveEvent()</a> and +<a href="ntqwidget.html#dragLeaveEvent">dragLeaveEvent()</a> will also be necessary. <p> For example, to accept text and image drops: <pre> MyWidget::MyWidget(...) : - <a href="qwidget.html">TQWidget</a>(...) + <a href="ntqwidget.html">TQWidget</a>(...) { ... setAcceptDrops(TRUE); @@ -114,8 +114,8 @@ void MyWidget::dragEnterEvent(TQDragEnterEvent* event) void MyWidget::dropEvent(TQDropEvent* event) { - <a href="qimage.html">TQImage</a> image; - <a href="qstring.html">TQString</a> text; + <a href="ntqimage.html">TQImage</a> image; + <a href="ntqstring.html">TQString</a> text; if ( TQImageDrag::<a href="qimagedrag.html#decode">decode</a>(event, image) ) { insertImageAt(image, event->pos()); @@ -127,11 +127,11 @@ void MyWidget::dropEvent(TQDropEvent* event) <p> <h2> The Clipboard </h2> -<a name="3"></a><p> The <a href="qdragobject.html">TQDragObject</a>, <a href="qdragenterevent.html">TQDragEnterEvent</a>, <a href="qdragmoveevent.html">TQDragMoveEvent</a>, and <a href="qdropevent.html">TQDropEvent</a> +<a name="3"></a><p> The <a href="ntqdragobject.html">TQDragObject</a>, <a href="qdragenterevent.html">TQDragEnterEvent</a>, <a href="qdragmoveevent.html">TQDragMoveEvent</a>, and <a href="qdropevent.html">TQDropEvent</a> classes are all subclasses of TQMimeSource: the class of objects which provide typed information. If you base your data transfers on TQDragObject, you not only get drag-and-drop, but you also get -traditional cut-and-paste for free. The <a href="qclipboard.html">TQClipboard</a> has two functions: +traditional cut-and-paste for free. The <a href="ntqclipboard.html">TQClipboard</a> has two functions: <pre> setData(TQMimeSource*) <a href="qmimesource.html">TQMimeSource</a>* data()const @@ -142,38 +142,38 @@ information on the clipboard: <pre> void MyWidget::copy() { - TQApplication::<a href="qapplication.html#clipboard">clipboard</a>()->setData( + TQApplication::<a href="ntqapplication.html#clipboard">clipboard</a>()->setData( new <a href="qtextdrag.html">TQTextDrag</a>(myHighlightedText()) ); } void MyWidget::paste() { - <a href="qstring.html">TQString</a> text; - if ( TQTextDrag::<a href="qtextdrag.html#decode">decode</a>(TQApplication::<a href="qapplication.html#clipboard">clipboard</a>()->data(), text) ) + <a href="ntqstring.html">TQString</a> text; + if ( TQTextDrag::<a href="qtextdrag.html#decode">decode</a>(TQApplication::<a href="ntqapplication.html#clipboard">clipboard</a>()->data(), text) ) insertText( text ); } </pre> -You can even use <a href="qdragobject.html">TQDragObject</a> subclasses as part of file IO. For +You can even use <a href="ntqdragobject.html">TQDragObject</a> 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: <pre> void MyWidget::save() { - <a href="qfile.html">TQFile</a> out(current_file_name); - if ( out.<a href="qfile.html#open">open</a>(IO_WriteOnly) ) { + <a href="ntqfile.html">TQFile</a> out(current_file_name); + if ( out.<a href="ntqfile.html#open">open</a>(IO_WriteOnly) ) { MyCadDrag tmp(current_design); - out.<a href="qiodevice.html#writeBlock">writeBlock</a>( tmp->encodedData( "image/x-dxf" ) ); + out.<a href="ntqiodevice.html#writeBlock">writeBlock</a>( tmp->encodedData( "image/x-dxf" ) ); } } void MyWidget::load() { - <a href="qfile.html">TQFile</a> in(current_file_name); - if ( in.<a href="qfile.html#open">open</a>(IO_ReadOnly) ) { - if ( !MyCadDrag::decode(in.<a href="qiodevice.html#readAll">readAll</a>(), current_design) ) { - TQMessageBox::<a href="qmessagebox.html#warning">warning</a>( this, "Format error", + <a href="ntqfile.html">TQFile</a> in(current_file_name); + if ( in.<a href="ntqfile.html#open">open</a>(IO_ReadOnly) ) { + if ( !MyCadDrag::decode(in.<a href="ntqiodevice.html#readAll">readAll</a>(), current_design) ) { + TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>( this, "Format error", tr("The file \"%1\" is not in any supported format") .arg(current_file_name) ); @@ -182,9 +182,9 @@ void MyWidget::load() } </pre> -Note how the <a href="qdragobject.html">TQDragObject</a> subclass is called "MyCadDrag", not +Note how the <a href="ntqdragobject.html">TQDragObject</a> subclass is called "MyCadDrag", not "MyDxfDrag": because in the future you might extend it to provide -DXF, DWG, SVF, WMF, or even <a href="qpicture.html">TQPicture</a> data to other applications. +DXF, DWG, SVF, WMF, or even <a href="ntqpicture.html">TQPicture</a> data to other applications. <p> <h2> Drag and Drop Actions </h2> <a name="4"></a><p> In the simpler cases, the target of a drag-and-drop receives a copy of @@ -218,7 +218,7 @@ provides for "<tt>image/*</tt>", where <tt>*</tt> is any image format that "<tt>text/uri-list</tt>", a standard format for transferring a list of filenames (or URLs). <p> To implement drag-and-drop of some type of information for which there -is no available <a href="qdragobject.html">TQDragObject</a> subclass, the first and most important +is no available <a href="ntqdragobject.html">TQDragObject</a> subclass, the first and most important step is to look for existing formats that are appropriate: the Internet Assigned Numbers Authority (<a href="http://www.iana.org">IANA</a>) provides a <a href="http://www.isi.edu/in-notes/iana/assignments/media-types/">hierarchical list of MIME media types</a> at the Information Sciences Institute @@ -259,14 +259,14 @@ the drag start point and the drop event might look like this: <p> <pre> void MyEditor::startDrag() { - <a href="qdragobject.html">TQDragObject</a> *d = new <a href="qtextdrag.html">TQTextDrag</a>(myHighlightedText(), this); - if ( d-><a href="qdragobject.html#drag">drag</a>() && d-><a href="qdragobject.html#target">target</a>() != this ) + <a href="ntqdragobject.html">TQDragObject</a> *d = new <a href="qtextdrag.html">TQTextDrag</a>(myHighlightedText(), this); + if ( d-><a href="ntqdragobject.html#drag">drag</a>() && d-><a href="ntqdragobject.html#target">target</a>() != this ) cutMyHighlightedText(); } void MyEditor::dropEvent(TQDropEvent* event) { - <a href="qstring.html">TQString</a> text; + <a href="ntqstring.html">TQString</a> text; if ( TQTextDrag::<a href="qtextdrag.html#decode">decode</a>(event, text) ) { if ( event->source() == this && event->action() == TQDropEvent::Move ) { @@ -283,7 +283,7 @@ void MyEditor::dropEvent(TQDropEvent* event) <p> Some widgets are more specific than just a "yes" or "no" response when data is dragged onto them. For example, a CAD program might only accept drops of text onto text objects in the view. In these cases, -the <a href="qwidget.html#dragMoveEvent">dragMoveEvent()</a> is used and +the <a href="ntqwidget.html#dragMoveEvent">dragMoveEvent()</a> is used and an <em>area</em> is given for which the drag is accepted or ignored: <pre> void MyWidget::dragMoveEvent(TQDragMoveEvent* event) @@ -305,7 +305,7 @@ void MyWidget::dragMoveEvent(TQDragMoveEvent* event) if ( TQTextDrag::<a href="qtextdrag.html#canDecode">canDecode</a>(event) ) { MyCadItem* item = findMyItemAt(event->pos()); if ( item ) { - <a href="qrect.html">TQRect</a> r = item->areaRelativeToMeClippedByAnythingInTheWay(); + <a href="ntqrect.html">TQRect</a> r = item->areaRelativeToMeClippedByAnythingInTheWay(); if ( item->type() == MyTextType ) event->accept( r ); else @@ -319,12 +319,12 @@ void MyWidget::dragMoveEvent(TQDragMoveEvent* event) feedback as the drag progresses, to start timers, to scroll the window, or whatever is appropriate (don't forget to stop the scrolling and timers in a dragLeaveEvent() though). -<p> The <a href="qapplication.html">TQApplication</a> object (available as the <tt>qApp</tt> global) also +<p> The <a href="ntqapplication.html">TQApplication</a> object (available as the <tt>qApp</tt> global) also provides some drag and drop related functions: -<a href="qapplication.html#setStartDragTime">TQApplication::setStartDragTime</a>(), -<a href="qapplication.html#setStartDragDistance">TQApplication::setStartDragDistance</a>(), and their corresponding -getters, <a href="qapplication.html#startDragTime">TQApplication::startDragTime</a>() and -<a href="qapplication.html#startDragDistance">TQApplication::startDragDistance</a>(). +<a href="ntqapplication.html#setStartDragTime">TQApplication::setStartDragTime</a>(), +<a href="ntqapplication.html#setStartDragDistance">TQApplication::setStartDragDistance</a>(), and their corresponding +getters, <a href="ntqapplication.html#startDragTime">TQApplication::startDragTime</a>() and +<a href="ntqapplication.html#startDragDistance">TQApplication::startDragDistance</a>(). <p> <h2> Inter-operating with Other Applications </h2> <a name="7"></a><p> On X11, the public <a class="r" |