summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/kernel.pri5
-rw-r--r--src/gui/kernel/qdnd.cpp (renamed from src/widgets/to_be_moved/qdnd.cpp)7
-rw-r--r--src/gui/kernel/qdnd_p.h (renamed from src/widgets/to_be_moved/qdnd_p.h)19
-rw-r--r--src/gui/kernel/qdnd_qpa.cpp (renamed from src/widgets/to_be_moved/qdnd_qpa.cpp)54
-rw-r--r--src/gui/kernel/qdrag.cpp (renamed from src/widgets/to_be_moved/qdrag.cpp)11
-rw-r--r--src/gui/kernel/qdrag.h (renamed from src/widgets/to_be_moved/qdrag.h)12
-rw-r--r--src/tools/uic/qclass_lib_map.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/to_be_moved/to_be_moved.pri5
9 files changed, 58 insertions, 59 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 6fda4fd62f..8662329a2d 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -9,6 +9,8 @@ HEADERS += \
kernel/qclipboard.h \
kernel/qcursor.h \
kernel/qcursor_p.h \
+ kernel/qdrag.h \
+ kernel/qdnd_p.h \
kernel/qevent.h \
kernel/qevent_p.h \
kernel/qkeysequence.h \
@@ -22,6 +24,9 @@ HEADERS += \
SOURCES += \
kernel/qclipboard.cpp \
kernel/qcursor.cpp \
+ kernel/qdrag.cpp \
+ kernel/qdnd.cpp \
+ kernel/qdnd_qpa.cpp \
kernel/qevent.cpp \
kernel/qkeysequence.cpp \
kernel/qkeymapper.cpp \
diff --git a/src/widgets/to_be_moved/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index db79b9042d..55fc3b09fc 100644
--- a/src/widgets/to_be_moved/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -49,7 +49,6 @@
#include "qtextcodec.h"
#include "qguiapplication.h"
#include "qpoint.h"
-#include "qwidget.h"
#include "qbuffer.h"
#include "qimage.h"
#include "qregexp.h"
@@ -162,7 +161,7 @@ QDragManager::~QDragManager()
QDragManager *QDragManager::self()
{
- if (!instance && !QApplication::closingDown())
+ if (!instance && !QGuiApplication::closingDown())
instance = new QDragManager;
return instance;
}
@@ -257,7 +256,7 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
return defaultAction;
}
-void QDragManager::setCurrentTarget(QWidget *target, bool dropped)
+void QDragManager::setCurrentTarget(QObject *target, bool dropped)
{
if (currentDropTarget == target)
return;
@@ -270,7 +269,7 @@ void QDragManager::setCurrentTarget(QWidget *target, bool dropped)
}
-QWidget *QDragManager::currentTarget()
+QObject *QDragManager::currentTarget()
{
return currentDropTarget;
}
diff --git a/src/widgets/to_be_moved/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index dc18ffa22e..cc74889bcb 100644
--- a/src/widgets/to_be_moved/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -56,7 +56,7 @@
#include "QtCore/qobject.h"
#include "QtCore/qmap.h"
#include "QtGui/qmime.h"
-#include "QtWidgets/qdrag.h"
+#include "QtGui/qdrag.h"
#include "QtGui/qpixmap.h"
#include "QtGui/qcursor.h"
#include "QtCore/qpoint.h"
@@ -174,8 +174,8 @@ private:
class QDragPrivate : public QObjectPrivate
{
public:
- QWidget *source;
- QWidget *target;
+ QObject *source;
+ QObject *target;
QMimeData *data;
QPixmap pixmap;
QPoint hotspot;
@@ -203,7 +203,7 @@ public:
#endif
};
-class QDragManager: public QObject {
+class Q_GUI_EXPORT QDragManager: public QObject {
Q_OBJECT
QDragManager();
@@ -213,9 +213,6 @@ class QDragManager: public QObject {
friend class QDragMoveEvent;
friend class QDropEvent;
friend class QApplication;
-#ifdef Q_WS_MAC
- friend class QWidgetPrivate; //dnd is implemented here
-#endif
bool eventFilter(QObject *, QEvent *);
void timerEvent(QTimerEvent*);
@@ -227,7 +224,7 @@ public:
void move(const QPoint &);
void drop();
void updatePixmap();
- QWidget *source() const { return object ? object->d_func()->source : 0; }
+ QObject *source() const { return object ? object->d_func()->source : 0; }
QDragPrivate *dragPrivate() const { return object ? object->d_func() : 0; }
static QDragPrivate *dragPrivate(QDrag *drag) { return drag ? drag->d_func() : 0; }
@@ -252,8 +249,8 @@ public:
void emitActionChanged(Qt::DropAction newAction) { if (object) emit object->actionChanged(newAction); }
- void setCurrentTarget(QWidget *target, bool dropped = false);
- QWidget *currentTarget();
+ void setCurrentTarget(QObject *target, bool dropped = false);
+ QObject *currentTarget();
#ifdef Q_WS_X11
QPixmap xdndMimeTransferedPixmap[2];
@@ -269,7 +266,7 @@ private:
QCursor overrideCursor;
#endif
#endif
- QWidget *currentDropTarget;
+ QObject *currentDropTarget;
static QDragManager *instance;
Q_DISABLE_COPY(QDragManager)
diff --git a/src/widgets/to_be_moved/qdnd_qpa.cpp b/src/gui/kernel/qdnd_qpa.cpp
index 82e8d580ae..e5715bb568 100644
--- a/src/widgets/to_be_moved/qdnd_qpa.cpp
+++ b/src/gui/kernel/qdnd_qpa.cpp
@@ -43,13 +43,13 @@
#ifndef QT_NO_DRAGANDDROP
-#include "qwidget.h"
#include "qdatetime.h"
#include "qbitmap.h"
#include "qcursor.h"
#include "qevent.h"
#include "qpainter.h"
#include "qdnd_p.h"
+#include "qwindow.h"
QT_BEGIN_NAMESPACE
@@ -86,39 +86,45 @@ static bool qt_qws_dnd_dragging = false;
static Qt::KeyboardModifiers oldstate;
-class QShapedPixmapWidget : public QWidget {
+class QShapedPixmapWindow : public QWindow {
QPixmap pixmap;
public:
- QShapedPixmapWidget() :
- QWidget(0, Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint)
+ QShapedPixmapWindow() :
+ QWindow(0)
{
- // ### Temporary workaround for 4.2-rc1!!! To prevent flickering when
- // using drag'n drop in a client application. (task 126956)
- // setAttribute() should be done unconditionally!
- // if (QApplication::type() == QApplication::GuiServer)
- setAttribute(Qt::WA_TransparentForMouseEvents);
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+ // ### Should we set the surface type to raster?
+ // ### FIXME
+// setAttribute(Qt::WA_TransparentForMouseEvents);
}
+ void move(const QPoint &p) {
+ QRect g = geometry();
+ g.setTopLeft(p);
+ setGeometry(g);
+ }
void setPixmap(QPixmap pm)
{
pixmap = pm;
- if (!pixmap.mask().isNull()) {
- setMask(pixmap.mask());
- } else {
- clearMask();
- }
- resize(pm.width(),pm.height());
+ // ###
+// if (!pixmap.mask().isNull()) {
+// setMask(pixmap.mask());
+// } else {
+// clearMask();
+// }
+// resize(pm.width(),pm.height());
}
- void paintEvent(QPaintEvent*)
- {
- QPainter p(this);
- p.drawPixmap(0,0,pixmap);
- }
+ // ### Get it painted again!
+// void paintEvent(QPaintEvent*)
+// {
+// QPainter p(this);
+// p.drawPixmap(0,0,pixmap);
+// }
};
-static QShapedPixmapWidget *qt_qws_dnd_deco = 0;
+static QShapedPixmapWindow *qt_qws_dnd_deco = 0;
void QDragManager::updatePixmap()
@@ -175,6 +181,8 @@ void QDragManager::updateCursor()
bool QDragManager::eventFilter(QObject *o, QEvent *e)
{
+#if 0
+ // ###
if (beingCancelled) {
if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
qApp->removeEventFilter(this);
@@ -313,7 +321,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e)
default:
break;
}
-
+#endif
return false;
}
@@ -329,7 +337,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
}
object = drag_object = o;
- qt_qws_dnd_deco = new QShapedPixmapWidget();
+ qt_qws_dnd_deco = new QShapedPixmapWindow();
oldstate = Qt::NoModifier; // #### Should use state that caused the drag
// drag_mode = mode;
diff --git a/src/widgets/to_be_moved/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index d8d14cb45c..bb56d061c1 100644
--- a/src/widgets/to_be_moved/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-#include <qwidget.h>
#include <qdrag.h>
#include <qpixmap.h>
#include <qpoint.h>
@@ -66,7 +65,7 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/dragging/mainwindow.cpp 1
Note that setMimeData() assigns ownership of the QMimeData object to the
- QDrag object. The QDrag must be constructed on the heap with a parent QWidget
+ QDrag object. The QDrag must be constructed on the heap with a parent QObject
to ensure that Qt can clean up after the drag and drop operation has been
completed.
@@ -107,7 +106,7 @@ QT_BEGIN_NAMESPACE
/*!
Constructs a new drag object for the widget specified by \a dragSource.
*/
-QDrag::QDrag(QWidget *dragSource)
+QDrag::QDrag(QObject *dragSource)
: QObject(*new QDragPrivate, dragSource)
{
Q_D(QDrag);
@@ -203,7 +202,7 @@ QPoint QDrag::hotSpot() const
Returns the source of the drag object. This is the widget where the drag
and drop operation originated.
*/
-QWidget *QDrag::source() const
+QObject *QDrag::source() const
{
Q_D(const QDrag);
return d->source;
@@ -213,7 +212,7 @@ QWidget *QDrag::source() const
Returns the target of the drag and drop operation. This is the widget where
the drag object was dropped.
*/
-QWidget *QDrag::target() const
+QObject *QDrag::target() const
{
Q_D(const QDrag);
return d->target;
@@ -346,7 +345,7 @@ void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)
*/
/*!
- \fn void QDrag::targetChanged(QWidget *newTarget)
+ \fn void QDrag::targetChanged(QObject *newTarget)
This signal is emitted when the target of the drag and drop
operation changes, with \a newTarget the new target.
diff --git a/src/widgets/to_be_moved/qdrag.h b/src/gui/kernel/qdrag.h
index da847898b2..d014382e8c 100644
--- a/src/widgets/to_be_moved/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -53,7 +53,6 @@ QT_MODULE(Gui)
#ifndef QT_NO_DRAGANDDROP
class QMimeData;
class QDragPrivate;
-class QWidget;
class QPixmap;
class QPoint;
class QDragManager;
@@ -63,7 +62,7 @@ class Q_GUI_EXPORT QDrag : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QDrag)
public:
- explicit QDrag(QWidget *dragSource);
+ explicit QDrag(QObject *dragSource);
~QDrag();
void setMimeData(QMimeData *data);
@@ -75,8 +74,8 @@ public:
void setHotSpot(const QPoint &hotspot);
QPoint hotSpot() const;
- QWidget *source() const;
- QWidget *target() const;
+ QObject *source() const;
+ QObject *target() const;
Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction);
Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
@@ -86,12 +85,9 @@ public:
Q_SIGNALS:
void actionChanged(Qt::DropAction action);
- void targetChanged(QWidget *newTarget);
+ void targetChanged(QObject *newTarget);
private:
-#ifdef Q_WS_MAC
- friend class QWidgetPrivate;
-#endif
friend class QDragManager;
Q_DISABLE_COPY(QDrag)
};
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index f36d77fd13..d2efcd400f 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -757,7 +757,7 @@ QT_CLASS_LIB(QCursor, QtGui, qcursor.h)
QT_CLASS_LIB(QCursor, QtGui, qcursor.h)
QT_CLASS_LIB(QCursorShape, QtWidgets, qcursor.h)
QT_CLASS_LIB(QDesktopWidget, QtWidgets, qdesktopwidget.h)
-QT_CLASS_LIB(QDrag, QtGui, qdrag.h)
+QT_CLASS_LIB(QDrag, QtWidgets, qdrag.h)
QT_CLASS_LIB(QtEvents, QtGui, qevent.h)
QT_CLASS_LIB(QInputEvent, QtGui, qevent.h)
QT_CLASS_LIB(QMouseEvent, QtGui, qevent.h)
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 059c06d162..bebf74e45f 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4055,7 +4055,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool isProxyWidget = extra && extra->proxyWidget;
if (!isProxyWidget)
#endif
- w = QDragManager::self()->currentTarget();
+ w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget());
if (!w) {
#ifdef Q_WS_MAC
diff --git a/src/widgets/to_be_moved/to_be_moved.pri b/src/widgets/to_be_moved/to_be_moved.pri
index d09c568c69..95bfc0a2b4 100644
--- a/src/widgets/to_be_moved/to_be_moved.pri
+++ b/src/widgets/to_be_moved/to_be_moved.pri
@@ -4,14 +4,9 @@ HEADERS += \
to_be_moved/qtextcontrol_p_p.h \
to_be_moved/qshortcut.h \
to_be_moved/qshortcutmap_p.h \
- to_be_moved/qdrag.h \
- to_be_moved/qdnd_p.h \
SOURCES += \
to_be_moved/qlinecontrol.cpp \
to_be_moved/qtextcontrol.cpp \
to_be_moved/qshortcut.cpp \
to_be_moved/qshortcutmap.cpp \
- to_be_moved/qdrag.cpp \
- to_be_moved/qdnd.cpp \
- to_be_moved/qdnd_qpa.cpp \