[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Fri Sep 3 11:07:44 CEST 2010
SVN commit 1171253 by kuemmel:
disable unfinished d&d
M +20 -12 viewitem.cpp
M +3 -0 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1171252:1171253
@@ -49,6 +49,9 @@
// TODO check for memory leaks when enabled.
//#define KST_DISBALE_QOBJECT_PARENT
+// disbale drag & drop
+#define KST_DISABLE_DD
+
namespace Kst {
ViewItem::ViewItem(View *parentView) :
@@ -945,20 +948,11 @@
Q_UNUSED(menu);
}
-
-void ViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
- if (parentView()->viewMode() == View::Data) {
- event->ignore();
- return;
- }
-
- if (!dragStartPosition.isNull() && event->buttons() & Qt::LeftButton)
- if ((event->pos() - dragStartPosition).toPoint().manhattanLength() > QApplication::startDragDistance()) {
-
+void ViewItem::startDragging(QWidget *widget) {
// UNDO tied zoom settings done in PlotItem::mousePressEvent
setTiedZoom(false, false);
- QDrag *drag = new QDrag(event->widget());
+ QDrag *drag = new QDrag(widget);
MimeDataViewItem* mimeData = new MimeDataViewItem;
mimeData->item = this;
drag->setMimeData(mimeData);
@@ -974,11 +968,25 @@
Qt::DropActions dact = Qt::MoveAction;
Qt::DropAction dropAction = drag->exec(dact);
if (dropAction == Qt::MoveAction) {
+ }
+}
+
+void ViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+ if (parentView()->viewMode() == View::Data) {
+ event->ignore();
+ return;
+ }
+
+#ifndef KST_DISABLE_DD
+ if (!dragStartPosition.isNull() && event->buttons() & Qt::LeftButton) {
+ if ((event->pos() - dragStartPosition).toPoint().manhattanLength() > QApplication::startDragDistance()) {
+ startDragging(event->widget());
} else {
- // we are starting drag$drop
+ // we are starting drag&drop
return;
}
}
+#endif
if (parentView()->mouseMode() == View::Default) {
if (gripMode() == ViewItem::Move || activeGrip() == NoGrip) {
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1171252:1171253
@@ -283,6 +283,7 @@
virtual void updateChildGeometry(const QRectF &oldParentRect, const QRectF &newParentRect);
virtual QString _automaticDescriptiveName() const;
virtual void _initializeShortName();
+
private:
GripMode _gripMode;
GripModes _allowedGripModes;
@@ -324,6 +325,8 @@
QObject* parent() const;
void setParent(QObject*);
+ void startDragging(QWidget *widget);
+
friend class View;
friend class Scene;
};
More information about the Kst
mailing list