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;
}
void Applet::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
}
void Applet::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
}
void Applet::timerEvent(QTimerEvent *event)
{
if (d->transient) {

View File

@ -893,21 +893,9 @@ class PLASMA_EXPORT Applet : public QObject
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
/**
* Reimplemented from QGraphicsLayoutItem
*/
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
*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -124,11 +124,10 @@ public:
/**
* Handles dropped/pasted mimetype data
* @param scenePos scene-relative position
* @param screenPos screen-relative position
* @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