QDragObject(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’… QDragObject β€” like, the manual page, bestie

okay so you're reading the QDragObject(3qt) man page and honestly? iconic of you. this is Qt 3.3.8 energy, we're going back in time a lil bit, but the vibes are immaculate. let's get into it πŸŽ€


✨ NAME ✨

QDragObject β€” encapsulates MIME-based data transfer. that's the whole assignment. it wraps up your data so it can travel between apps and within apps like a little ✨messenger✨.


🌈 SYNOPSIS 🌈

#include <qdragobject.h>

Inherits QObject and QMimeSource.

Inherited by QStoredDrag, QTextDrag, QImageDrag, and QIconDrag.

🌸 Public Members 🌸

  • QDragObject ( QWidget * dragSource = 0, const char * name = 0 )
  • virtual ~QDragObject ()
  • bool drag ()
  • bool dragMove ()
  • void dragCopy ()
  • void dragLink ()
  • virtual void setPixmap ( QPixmap pm )
  • virtual void setPixmap ( QPixmap pm, const QPoint & hotspot )
  • QPixmap pixmap () const
  • QPoint pixmapHotSpot () const
  • QWidget * source ()
  • enum DragMode { DragDefault, DragCopy, DragMove, DragLink, DragCopyOrMove }

πŸ’« Static Public Members πŸ’«

  • QWidget * target ()

πŸ¦‹ Protected Members πŸ¦‹

  • virtual bool drag ( DragMode mode )

πŸ’– DESCRIPTION πŸ’–

the QDragObject class encapsulates MIME-based data transfer. no cap.

QDragObject is the base class for all data that needs to be transferred between and within applications β€” both for drag and drop and for the clipboard. she does it all πŸ’…

  • See the Drag-and-drop documentation for an overview of how to provide drag and drop in your application.
  • See the QClipboard documentation for an overview of how to provide cut-and-paste in your application.

so here's the tea β˜• β€” the drag() function is what you call to start a drag operation. you can specify the DragMode right there in the call, or you can use one of the convenience functions: dragCopy(), dragMove(), or dragLink(). the drag source (aka where the data originated from, her origin story) is retrieved with source(). and if the data got dropped on a widget within the application, target() will hand you back a pointer to that widget. wanna set the lil picture that shows up while you're dragging? that's setPixmap(). πŸ–ΌοΈ

See also Drag And Drop Classes.


🧚 Member Type Documentation 🧚

QDragObject::DragMode

this enum describes the possible drag modes. the menu of options, if you will πŸ“

  • QDragObject::DragDefault β€” the mode is determined heuristically. she decides for herself, main character behavior.
  • QDragObject::DragCopy β€” the data is copied, never moved. it stays home.
  • QDragObject::DragMove β€” the data is moved, if dragged at all.
  • QDragObject::DragLink β€” the data is linked, if dragged at all.
  • QDragObject::DragCopyOrMove β€” the user chooses the mode by using a control key to switch from the default. letting the people decide, love that for them.

πŸ”₯ MEMBER FUNCTION DOCUMENTATION πŸ”₯

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

constructs a drag object called name, which is a child of dragSource. 🫢

note that the drag object will be deleted when dragSource is deleted. so like, don't get attached, she goes down with the ship πŸ’€

QDragObject::~QDragObject () [virtual]

destroys the drag object, canceling any drag and drop operation in which it is involved, and frees up the storage used. clean exit, no loose ends ✨


bool QDragObject::drag ()

starts a drag operation using the contents of this object, using DragDefault mode.

the function returns TRUE if the caller should delete the original copy of the dragged data (but see target()); otherwise returns FALSE.

if the drag contains references to information (e.g. file names in a QUriDrag are references) then the return value should always be ignored, as the target is expected to manipulate the referred-to content directly. on X11 the return value should always be correct anyway, but on Windows this is not necessarily the case (e.g. the file manager starts a background process to move files, so the source must not delete the files!) 😭

note that on Windows the drag operation will spin a blocking modal event loop that will not dispatch any QTimers. she's busy, do not disturb πŸ™ˆ

Example: dirview/dirview.cpp.


bool QDragObject::drag ( DragMode mode ) [virtual protected]

this is an overloaded member function, provided for convenience. it behaves essentially like the above function.

starts a drag operation using the contents of this object.

at this point, the object becomes owned by Qt, not the application. you should not delete the drag object or anything it references. the actual transfer of data to the target application will be done during future event processing β€” after that time the drag object will be deleted. so like, hands off, she's Qt's problem now πŸ’…

returns TRUE if the dragged data was dragged as a move, indicating that the caller should remove the original source of the data (the drag object must continue to have a copy); otherwise returns FALSE.

the mode specifies the drag mode (see QDragObject::DragMode.) normally one of the simpler drag(), dragMove(), or dragCopy() functions would be used instead.


void QDragObject::dragCopy ()

starts a drag operation using the contents of this object, using DragCopy mode. be sure to read the constraints described in drag(). πŸ‘€

See also drag(), dragMove(), and dragLink().

Example: iconview/simple_dd/main.cpp.


starts a drag operation using the contents of this object, using DragLink mode. be sure to read the constraints described in drag(). πŸ‘€

See also drag(), dragCopy(), and dragMove().


bool QDragObject::dragMove ()

starts a drag operation using the contents of this object, using DragMove mode. be sure to read the constraints described in drag(). πŸ‘€

See also drag(), dragCopy(), and dragLink().


QPixmap QDragObject::pixmap () const

returns the currently set pixmap (which is isNull() if none is set). no pixmap? she's null, and that's valid πŸ’€


QPoint QDragObject::pixmapHotSpot () const

returns the currently set pixmap hotspot.


void QDragObject::setPixmap ( QPixmap pm, const QPoint & hotspot ) [virtual]

set the pixmap pm to display while dragging the object. the platform-specific implementation will use this where it can β€” so provide a small masked pixmap, and do not assume that the user will actually see it. for example, cursors on Windows 95 are of limited size. bestie the 90s were rough πŸŽ€

the hotspot is the point on (or off) the pixmap that should be under the cursor as it is dragged. it is relative to the top-left pixel of the pixmap.

Warning: we have seen problems with drag cursors on different graphics hardware and driver software on Windows. setting the graphics acceleration in the display settings down one tick solved the problems in all cases. not me giving you tech support in a manpage πŸ’€

Example: fileiconview/qfileiconview.cpp.


void QDragObject::setPixmap ( QPixmap pm ) [virtual]

this is an overloaded member function, provided for convenience. it behaves essentially like the above function.

uses a hotspot that positions the pixmap below and to the right of the mouse pointer. this allows the user to clearly see the point on the window which they are dragging the data onto. πŸ‘‘ considerate queen behavior honestly


QWidget * QDragObject::source ()

returns a pointer to the drag source where this object originated.


QWidget * QDragObject::target () [static]

after the drag completes, this function will return the QWidget which received the drop, or 0 if the data was dropped on another application. iykyk, 0 means she left the app πŸ¦‹

this can be useful for detecting the case where drag and drop is to and from the same widget. self-love, we stan πŸ’œ


🌟 SEE ALSO 🌟


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


✍️ AUTHOR ✍️

Generated automatically from the source code. no human wrote this, she's born from the machine πŸ€–βœ¨


πŸ› BUGS πŸ›

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qdragobject.3qt) and the Qt version (3.3.8).


okay that's the whole page bestie, you ate that πŸ’…πŸŒΈβœ¨ β€” this was brought to you by Trolltech AS, dated 2 February 2007, running the QDragObject(3qt) era of Qt. go forth and drag and drop responsibly, mwah πŸ’–

πŸ“¦ where this page comes from