Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QGraphicsSceneDragDropEvent Class

TheQGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework.More...

Header:#include <QGraphicsSceneDragDropEvent>
Since: Qt 4.2
Inherits:QGraphicsSceneEvent

Public Functions

~QGraphicsSceneDragDropEvent()
voidacceptProposedAction()
Qt::MouseButtonsbuttons() const
Qt::DropActiondropAction() const
const QMimeData *mimeData() const
Qt::KeyboardModifiersmodifiers() const
QPointFpos() const
Qt::DropActionspossibleActions() const
Qt::DropActionproposedAction() const
QPointFscenePos() const
QPointscreenPos() const
voidsetDropAction(Qt::DropAction action)
QWidget *source() const

Additional Inherited Members

  • 1 property inherited fromQEvent
  • 1 static public member inherited fromQEvent

Detailed Description

TheQGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework.

QGraphicsView inherits the drag and drop functionality provided byQWidget. When it receives a drag and drop event, it translates it to aQGraphicsSceneDragDropEvent.

QGraphicsSceneDragDropEvent stores events of typeGraphicsSceneDragEnter,GraphicsSceneDragLeave,GraphicsSceneDragMove, orGraphicsSceneDrop.

QGraphicsSceneDragDropEvent contains the position of the mouse cursor in both item, scene, and screen coordinates; this can be retrieved withpos(),scenePos(), andscreenPos().

The scene sends the event to the firstQGraphicsItem under the mouse cursor that accepts drops; a graphics item is set to accept drops withsetAcceptDrops().

Member Function Documentation

QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent()

Destroys the object.

void QGraphicsSceneDragDropEvent::acceptProposedAction()

Sets the proposed action as accepted, i.e, the drop action is set to the proposed action. This is equal to:

setDropAction(proposedAction());

When using this function, one should not callaccept().

See alsodropAction(),setDropAction(), andproposedAction().

Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons() const

Returns aQt::MouseButtons value indicating which buttons were pressed on the mouse when this mouse event was generated.

See alsoQt::MouseButtons.

Qt::DropAction QGraphicsSceneDragDropEvent::dropAction() const

Returns the action that was performed in this drag and drop. This should be set by the receiver of the drop and is returned byQDrag::exec().

See alsosetDropAction() andacceptProposedAction().

constQMimeData * QGraphicsSceneDragDropEvent::mimeData() const

This function returns the MIME data of the event.

Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers() const

Returns the keyboard modifiers that were pressed when the drag and drop event was created.

See alsoQt::KeyboardModifiers.

QPointF QGraphicsSceneDragDropEvent::pos() const

Returns the mouse position of the event relative to the view that sent the event.

See alsoQGraphicsView,screenPos(), andscenePos().

Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions() const

Returns the possible drop actions that the drag and drop can result in.

See alsoQt::DropActions.

Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction() const

Returns the drop action that is proposed, i.e., preferred. The action must be one of the possible actions as defined bypossibleActions().

See alsoQt::DropAction andpossibleActions().

QPointF QGraphicsSceneDragDropEvent::scenePos() const

Returns the position of the mouse in scene coordinates.

See alsopos() andscreenPos().

QPoint QGraphicsSceneDragDropEvent::screenPos() const

Returns the position of the mouse relative to the screen.

See alsopos() andscenePos().

void QGraphicsSceneDragDropEvent::setDropAction(Qt::DropAction action)

This function lets the receiver of the drop set the drop action that was performed toaction, which should be one of thepossible actions. Callaccept() in stead ofacceptProposedAction() if you use this function.

See alsodropAction(),accept(), andpossibleActions().

QWidget * QGraphicsSceneDragDropEvent::source() const

This function returns theQGraphicsView that created theQGraphicsSceneDragDropEvent.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp