diff options
author | Chris Meyer <cmeyer1969@gmail.com> | 2013-08-26 16:15:23 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-09 22:58:45 +0200 |
commit | 391459210de53e342ba5e9c44360754e86d7625c (patch) | |
tree | f68fca8e2f059f8e07b2638245451137af79b479 /src/quick/items/qquickmousearea.cpp | |
parent | 2dcb0adc3a0a9b93b4cd09f26f2d1bac0e8cd110 (diff) |
Add support for external drag and drop in Quick items.
Add dragType enums with values of None, Automatic, Internal (default).
Setting to Automatic allows startDrag to be called automatically.
Setting to Internal (default) retains old behavior.
Add mimeData to Drag item to enable external drags.
Call startDrag to start drag manually or change from internal drag to
external drag. Added events dragStarted and dragFinished that get
invoked from startDrag.
Mime data must be specified in the mimeData property as
mime-type / data pairs.
Moved QQuickDrag from qquickmousearea* files to qquickdrag* files to
reduce header interdependencies that caused linking errors in other
modules and also to improve code organization.
Allow DropArea to receive and process external data.
Introduced new variable containsDrag to QQuickDropAreaPrivate. This
replaces mimeData which was previously being used to determine if a
drop operation was currently occurring. The problem was that mimeData
was being externally destructed.
Also introduced accessor methods for getting color, html, image, text,
and urls out of the drop. This facilitates dropping of external data of
those types onto a DropArea.
Added example quick/externaldraganddrop.
Task-number: QTBUG-27498
Change-Id: I1420df7c161ea3399e49a23305273e106baa246f
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick/items/qquickmousearea.cpp')
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 1970a03bee..8a73a5d73d 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -61,137 +61,6 @@ DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING) static const int PressAndHoldDelay = 800; -#ifndef QT_NO_DRAGANDDROP - -QQuickDrag::QQuickDrag(QObject *parent) -: QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX), -_xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false) -{ -} - -QQuickDrag::~QQuickDrag() -{ -} - -QQuickItem *QQuickDrag::target() const -{ - return _target; -} - -void QQuickDrag::setTarget(QQuickItem *t) -{ - if (_target == t) - return; - _target = t; - emit targetChanged(); -} - -void QQuickDrag::resetTarget() -{ - if (_target == 0) - return; - _target = 0; - emit targetChanged(); -} - -QQuickDrag::Axis QQuickDrag::axis() const -{ - return _axis; -} - -void QQuickDrag::setAxis(QQuickDrag::Axis a) -{ - if (_axis == a) - return; - _axis = a; - emit axisChanged(); -} - -qreal QQuickDrag::xmin() const -{ - return _xmin; -} - -void QQuickDrag::setXmin(qreal m) -{ - if (_xmin == m) - return; - _xmin = m; - emit minimumXChanged(); -} - -qreal QQuickDrag::xmax() const -{ - return _xmax; -} - -void QQuickDrag::setXmax(qreal m) -{ - if (_xmax == m) - return; - _xmax = m; - emit maximumXChanged(); -} - -qreal QQuickDrag::ymin() const -{ - return _ymin; -} - -void QQuickDrag::setYmin(qreal m) -{ - if (_ymin == m) - return; - _ymin = m; - emit minimumYChanged(); -} - -qreal QQuickDrag::ymax() const -{ - return _ymax; -} - -void QQuickDrag::setYmax(qreal m) -{ - if (_ymax == m) - return; - _ymax = m; - emit maximumYChanged(); -} - -bool QQuickDrag::active() const -{ - return _active; -} - -void QQuickDrag::setActive(bool drag) -{ - if (_active == drag) - return; - _active = drag; - emit activeChanged(); -} - -bool QQuickDrag::filterChildren() const -{ - return _filterChildren; -} - -void QQuickDrag::setFilterChildren(bool filter) -{ - if (_filterChildren == filter) - return; - _filterChildren = filter; - emit filterChildrenChanged(); -} - -QQuickDragAttached *QQuickDrag::qmlAttachedProperties(QObject *obj) -{ - return new QQuickDragAttached(obj); -} - -#endif // QT_NO_DRAGANDDROP - QQuickMouseAreaPrivate::QQuickMouseAreaPrivate() : enabled(true), hovered(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), |