This particular approach uses the QPoint::manhattanLength() function to get a rough estimate of the distance between where the mouse click occurred and the current cursor position. Qt ::DropAction dropAction = drag - >exec( Qt ::CopyAction | Qt ::MoveAction) If ((event - >pos() - dragStartPosition). If ( !(event - >buttons() & Qt ::LeftButton)) Void DragWidget ::mouseMoveEvent( QMouseEvent *event) However, the simplest way to enable dragging from a widget is to reimplement the widget's mousePressEvent() and start a drag and drop operation: In most applications, it is a good idea to begin a drag and drop operation only after a mouse button has been pressed and the cursor has been moved a certain distance. To start a drag, create a QDrag object, and call its exec() function. For using drag and drop inside a Qt Quick scene, please read the documentation for the Qt Quick Drag, DragEvent, and DropArea items, as well as the Qt Quick Drag and Drop examples. The rest of the document focuses mainly on how to implement drag and drop in C++. These quantities provide sensible default values that are compliant with the underlying windowing system for you to use if you provide drag and drop support in your controls. A value of 0 means that there is no such limit.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |