QGraphicsSceneDropEvent -> QDropEvent

This commit is contained in:
Marco Martin 2012-09-25 20:35:04 +02:00
parent f58711521e
commit e463c4af4f
9 changed files with 13 additions and 41 deletions

View File

@ -1418,16 +1418,6 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
return hint; return hint;
} }
void Applet::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
}
void Applet::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
}
void Applet::timerEvent(QTimerEvent *event) void Applet::timerEvent(QTimerEvent *event)
{ {
if (d->transient) { if (d->transient) {

View File

@ -893,21 +893,9 @@ class PLASMA_EXPORT Applet : public QObject
*/ */
virtual void constraintsEvent(Plasma::Constraints constraints); virtual void constraintsEvent(Plasma::Constraints constraints);
/**
* Reimplemented from QGraphicsLayoutItem
*/
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
/**
* Reimplemented from QGraphicsLayoutItem
*/
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
/**
* Reimplemented from QGraphicsLayoutItem
*/
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
/** /**
* Reimplemented from QObject * Reimplemented from QObject
*/ */

View File

@ -739,10 +739,10 @@ QStringList Containment::listContainmentTypes()
return types.toList(); return types.toList();
} }
void Containment::dropEvent(QGraphicsSceneDragDropEvent *event) void Containment::dropEvent(QDropEvent *event)
{ {
if (isContainment()) { if (isContainment()) {
d->dropData(event->scenePos(), event->screenPos(), event); d->dropData(event->pos(), event);
} }
} }

View File

@ -517,7 +517,7 @@ Q_SIGNALS:
* @reimp * @reimp
* @sa QGraphicsItem::dropEvent() * @sa QGraphicsItem::dropEvent()
*/ */
void dropEvent(QGraphicsSceneDragDropEvent *event); void dropEvent(QDropEvent *event);
/** /**
* @reimp * @reimp

View File

@ -233,7 +233,7 @@ void ContainmentActions::paste(QPointF scenePos, QPoint screenPos)
{ {
Containment *c = containment(); Containment *c = containment();
if (c) { if (c) {
c->d->dropData(scenePos, screenPos); c->d->dropData(screenPos);
} }
} }

View File

@ -25,8 +25,6 @@
#include <config-plasma.h> #include <config-plasma.h>
#include <QGraphicsLayout>
#include <QGraphicsView>
#include <QHostInfo> #include <QHostInfo>
#include <qstandardpaths.h> #include <qstandardpaths.h>

View File

@ -23,7 +23,6 @@
#define PLASMA_APPLET_P_H #define PLASMA_APPLET_P_H
#include <QBasicTimer> #include <QBasicTimer>
#include <QGraphicsProxyWidget>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kconfigdialog.h> #include <kconfigdialog.h>

View File

@ -24,10 +24,8 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QGraphicsSceneDragDropEvent>
#include <QMimeData> #include <QMimeData>
#include <QMimeDatabase> #include <QMimeDatabase>
#include <QGraphicsView>
#include <qtemporaryfile.h> #include <qtemporaryfile.h>
#include <kaction.h> #include <kaction.h>
@ -348,7 +346,7 @@ void ContainmentPrivate::showDropZoneDelayed()
dropPoints.remove(0); dropPoints.remove(0);
} }
void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsSceneDragDropEvent *dropEvent) void ContainmentPrivate::dropData(QPoint screenPos, QDropEvent *dropEvent)
{ {
if (q->immutability() != Mutable) { if (q->immutability() != Mutable) {
return; return;
@ -381,7 +379,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
const QStringList appletNames = data.split('\n', QString::SkipEmptyParts); const QStringList appletNames = data.split('\n', QString::SkipEmptyParts);
foreach (const QString &appletName, appletNames) { foreach (const QString &appletName, appletNames) {
//kDebug() << "doing" << appletName; //kDebug() << "doing" << appletName;
QRectF geom(scenePos, QSize(0, 0)); QRectF geom(screenPos, QSize(0, 0));
q->addApplet(appletName, QVariantList(), geom); q->addApplet(appletName, QVariantList(), geom);
} }
if (dropEvent) { if (dropEvent) {
@ -397,7 +395,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
if (dropEvent) { if (dropEvent) {
dropPoints[job] = dropEvent->pos(); dropPoints[job] = dropEvent->pos();
} else { } else {
dropPoints[job] = scenePos; dropPoints[job] = screenPos;
} }
QObject::connect(AccessManager::self(), SIGNAL(finished(Plasma::AccessAppletJob*)), QObject::connect(AccessManager::self(), SIGNAL(finished(Plasma::AccessAppletJob*)),
q, SLOT(remoteAppletReady(Plasma::AccessAppletJob*))); q, SLOT(remoteAppletReady(Plasma::AccessAppletJob*)));
@ -407,7 +405,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
QMimeDatabase db; QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl(url); QMimeType mime = db.mimeTypeForUrl(url);
QString mimeName = mime.name(); QString mimeName = mime.name();
QRectF geom(scenePos, QSize()); QRectF geom(screenPos, QSize());
QVariantList args; QVariantList args;
args << url.toString(); args << url.toString();
#ifndef NDEBUG #ifndef NDEBUG
@ -420,7 +418,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
if (dropEvent) { if (dropEvent) {
dropPoints[job] = dropEvent->pos(); dropPoints[job] = dropEvent->pos();
} else { } else {
dropPoints[job] = scenePos; dropPoints[job] = screenPos;
} }
QObject::connect(job, SIGNAL(result(KJob*)), q, SLOT(dropJobResult(KJob*))); QObject::connect(job, SIGNAL(result(KJob*)), q, SLOT(dropJobResult(KJob*)));
@ -430,7 +428,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
KMenu *choices = new KMenu("Content dropped"); KMenu *choices = new KMenu("Content dropped");
choices->addAction(KDE::icon("process-working"), i18n("Fetching file type...")); choices->addAction(KDE::icon("process-working"), i18n("Fetching file type..."));
if (dropEvent) { if (dropEvent) {
choices->popup(dropEvent->screenPos()); choices->popup(dropEvent->pos());
} else { } else {
choices->popup(screenPos); choices->popup(screenPos);
} }
@ -509,7 +507,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
stream.writeRawData(data, data.size()); stream.writeRawData(data, data.size());
} }
QRectF geom(scenePos, QSize()); QRectF geom(screenPos, QSize());
QVariantList args; QVariantList args;
args << tempFile.fileName(); args << tempFile.fileName();
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -124,11 +124,10 @@ public:
/** /**
* Handles dropped/pasted mimetype data * Handles dropped/pasted mimetype data
* @param scenePos scene-relative position
* @param screenPos screen-relative position * @param screenPos screen-relative position
* @param dropEvent the drop event (if null, the clipboard is used instead) * @param dropEvent the drop event (if null, the clipboard is used instead)
*/ */
void dropData(QPointF scenePos, QPoint screenPos, QGraphicsSceneDragDropEvent *dropEvent = 0); void dropData(QPoint screenPos, QDropEvent *dropEvent = 0);
/** /**
* inits the containmentactions if necessary * inits the containmentactions if necessary