tabs to spaces. fewer kittens are now being killed.
This commit is contained in:
parent
4c79f05a60
commit
a4e83dde8e
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "DeclarativeDragArea.h"
|
||||
@ -32,29 +32,29 @@
|
||||
#include <QGraphicsView>
|
||||
|
||||
/*!
|
||||
A DragArea is used to make an item draggable.
|
||||
A DragArea is used to make an item draggable.
|
||||
*/
|
||||
|
||||
DeclarativeDragArea::DeclarativeDragArea(QDeclarativeItem *parent)
|
||||
: QDeclarativeItem(parent),
|
||||
m_delegate(0),
|
||||
m_source(0),
|
||||
m_target(0),
|
||||
m_enabled(true),
|
||||
m_supportedActions(Qt::MoveAction),
|
||||
m_defaultAction(Qt::MoveAction),
|
||||
m_data(new DeclarativeMimeData()) // m_data is owned by us, and we shouldn't pass it to Qt directly as it will automatically delete it after the drag and drop.
|
||||
: QDeclarativeItem(parent),
|
||||
m_delegate(0),
|
||||
m_source(0),
|
||||
m_target(0),
|
||||
m_enabled(true),
|
||||
m_supportedActions(Qt::MoveAction),
|
||||
m_defaultAction(Qt::MoveAction),
|
||||
m_data(new DeclarativeMimeData()) // m_data is owned by us, and we shouldn't pass it to Qt directly as it will automatically delete it after the drag and drop.
|
||||
{
|
||||
m_startDragDistance = QApplication::startDragDistance();
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
setFiltersChildEvents(true);
|
||||
}
|
||||
|
||||
DeclarativeDragArea::~DeclarativeDragArea()
|
||||
{
|
||||
if (m_data) {
|
||||
delete m_data;
|
||||
}
|
||||
if (m_data) {
|
||||
delete m_data;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -63,18 +63,18 @@ DeclarativeDragArea::~DeclarativeDragArea()
|
||||
*/
|
||||
QDeclarativeComponent* DeclarativeDragArea::delegate() const
|
||||
{
|
||||
return m_delegate;
|
||||
return m_delegate;
|
||||
}
|
||||
void DeclarativeDragArea::setDelegate(QDeclarativeComponent *delegate)
|
||||
{
|
||||
if (m_delegate != delegate) {
|
||||
m_delegate = delegate;
|
||||
emit delegateChanged();
|
||||
}
|
||||
if (m_delegate != delegate) {
|
||||
m_delegate = delegate;
|
||||
emit delegateChanged();
|
||||
}
|
||||
}
|
||||
void DeclarativeDragArea::resetDelegate()
|
||||
{
|
||||
setDelegate(0);
|
||||
setDelegate(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -83,31 +83,31 @@ void DeclarativeDragArea::resetDelegate()
|
||||
*/
|
||||
QDeclarativeItem* DeclarativeDragArea::source() const
|
||||
{
|
||||
return m_source;
|
||||
return m_source;
|
||||
}
|
||||
void DeclarativeDragArea::setSource(QDeclarativeItem* source)
|
||||
{
|
||||
if (m_source != source) {
|
||||
m_source = source;
|
||||
emit sourceChanged();
|
||||
}
|
||||
if (m_source != source) {
|
||||
m_source = source;
|
||||
emit sourceChanged();
|
||||
}
|
||||
}
|
||||
void DeclarativeDragArea::resetSource()
|
||||
{
|
||||
setSource(0);
|
||||
setSource(0);
|
||||
}
|
||||
|
||||
// target
|
||||
QDeclarativeItem* DeclarativeDragArea::target() const
|
||||
{
|
||||
//TODO: implement me
|
||||
return 0;
|
||||
//TODO: implement me
|
||||
return 0;
|
||||
}
|
||||
|
||||
// data
|
||||
DeclarativeMimeData* DeclarativeDragArea::mimeData() const
|
||||
{
|
||||
return m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
||||
// startDragDistance
|
||||
@ -150,82 +150,82 @@ void DeclarativeDragArea::setDelegateImage(const QVariant &image)
|
||||
// enabled
|
||||
bool DeclarativeDragArea::isEnabled() const
|
||||
{
|
||||
return m_enabled;
|
||||
return m_enabled;
|
||||
}
|
||||
void DeclarativeDragArea::setEnabled(bool enabled)
|
||||
{
|
||||
if (enabled != m_enabled) {
|
||||
m_enabled = enabled;
|
||||
emit enabledChanged();
|
||||
}
|
||||
if (enabled != m_enabled) {
|
||||
m_enabled = enabled;
|
||||
emit enabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// supported actions
|
||||
Qt::DropActions DeclarativeDragArea::supportedActions() const
|
||||
{
|
||||
return m_supportedActions;
|
||||
return m_supportedActions;
|
||||
}
|
||||
void DeclarativeDragArea::setSupportedActions(Qt::DropActions actions)
|
||||
{
|
||||
if (actions != m_supportedActions) {
|
||||
m_supportedActions = actions;
|
||||
emit supportedActionsChanged();
|
||||
}
|
||||
if (actions != m_supportedActions) {
|
||||
m_supportedActions = actions;
|
||||
emit supportedActionsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// default action
|
||||
Qt::DropAction DeclarativeDragArea::defaultAction() const
|
||||
{
|
||||
return m_defaultAction;
|
||||
return m_defaultAction;
|
||||
}
|
||||
void DeclarativeDragArea::setDefaultAction(Qt::DropAction action)
|
||||
{
|
||||
if (action != m_defaultAction) {
|
||||
m_defaultAction = action;
|
||||
emit defaultActionChanged();
|
||||
}
|
||||
if (action != m_defaultAction) {
|
||||
m_defaultAction = action;
|
||||
emit defaultActionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void DeclarativeDragArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if ( !m_enabled
|
||||
|| QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton)).length()
|
||||
< m_startDragDistance) {
|
||||
return;
|
||||
}
|
||||
if ( !m_enabled
|
||||
|| QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton)).length()
|
||||
< m_startDragDistance) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDrag *drag = new QDrag(event->widget());
|
||||
DeclarativeMimeData* dataCopy = new DeclarativeMimeData(m_data); //Qt will take ownership of this copy and delete it.
|
||||
drag->setMimeData(dataCopy);
|
||||
QDrag *drag = new QDrag(event->widget());
|
||||
DeclarativeMimeData* dataCopy = new DeclarativeMimeData(m_data); //Qt will take ownership of this copy and delete it.
|
||||
drag->setMimeData(dataCopy);
|
||||
|
||||
if (!m_delegateImage.isNull()) {
|
||||
drag->setPixmap(QPixmap::fromImage(m_delegateImage));
|
||||
} else if (m_delegate) {
|
||||
|
||||
// Render the delegate to a Pixmap
|
||||
// Render the delegate to a Pixmap
|
||||
|
||||
QDeclarativeItem* item = qobject_cast<QDeclarativeItem *>(m_delegate->create());
|
||||
QDeclarativeItem* item = qobject_cast<QDeclarativeItem *>(m_delegate->create());
|
||||
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(item);
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(item);
|
||||
|
||||
QPixmap pixmap(scene.sceneRect().width(), scene.sceneRect().height());
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPixmap pixmap(scene.sceneRect().width(), scene.sceneRect().height());
|
||||
pixmap.fill(Qt::transparent);
|
||||
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
scene.render(&painter);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
scene.render(&painter);
|
||||
painter.end();
|
||||
delete item;
|
||||
|
||||
drag->setPixmap(pixmap);
|
||||
drag->setHotSpot(QPoint(0, 0)); // TODO: Make a property for that
|
||||
}
|
||||
drag->setPixmap(pixmap);
|
||||
drag->setHotSpot(QPoint(0, 0)); // TODO: Make a property for that
|
||||
}
|
||||
|
||||
//setCursor(Qt::OpenHandCursor); //TODO? Make a property for the cursor
|
||||
//setCursor(Qt::OpenHandCursor); //TODO? Make a property for the cursor
|
||||
|
||||
Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction);
|
||||
emit drop(action);
|
||||
Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction);
|
||||
emit drop(action);
|
||||
}
|
||||
|
||||
bool DeclarativeDragArea::sceneEventFilter(QGraphicsItem *item, QEvent *event)
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DECLARATIVEDRAGAREA_H
|
||||
@ -86,62 +86,62 @@ class DeclarativeDragArea : public QDeclarativeItem
|
||||
Q_PROPERTY(QVariant delegateImage READ delegateImage WRITE setDelegateImage NOTIFY delegateImageChanged)
|
||||
|
||||
public:
|
||||
DeclarativeDragArea(QDeclarativeItem *parent=0);
|
||||
~DeclarativeDragArea();
|
||||
DeclarativeDragArea(QDeclarativeItem *parent=0);
|
||||
~DeclarativeDragArea();
|
||||
|
||||
QDeclarativeComponent *delegate() const;
|
||||
void setDelegate(QDeclarativeComponent* delegate);
|
||||
void resetDelegate();
|
||||
QDeclarativeComponent *delegate() const;
|
||||
void setDelegate(QDeclarativeComponent* delegate);
|
||||
void resetDelegate();
|
||||
|
||||
QVariant delegateImage() const;
|
||||
void setDelegateImage(const QVariant &image);
|
||||
QDeclarativeItem* target() const;
|
||||
QDeclarativeItem* source() const;
|
||||
void setSource(QDeclarativeItem* source);
|
||||
void resetSource();
|
||||
QDeclarativeItem* target() const;
|
||||
QDeclarativeItem* source() const;
|
||||
void setSource(QDeclarativeItem* source);
|
||||
void resetSource();
|
||||
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool enabled);
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
int startDragDistance() const;
|
||||
void setStartDragDistance(int distance);
|
||||
|
||||
//supported actions
|
||||
Qt::DropActions supportedActions() const;
|
||||
void setSupportedActions(Qt::DropActions actions);
|
||||
//supported actions
|
||||
Qt::DropActions supportedActions() const;
|
||||
void setSupportedActions(Qt::DropActions actions);
|
||||
|
||||
//default action
|
||||
Qt::DropAction defaultAction() const;
|
||||
void setDefaultAction(Qt::DropAction action);
|
||||
//default action
|
||||
Qt::DropAction defaultAction() const;
|
||||
void setDefaultAction(Qt::DropAction action);
|
||||
|
||||
DeclarativeMimeData* mimeData() const;
|
||||
DeclarativeMimeData* mimeData() const;
|
||||
|
||||
signals:
|
||||
void delegateChanged();
|
||||
void sourceChanged();
|
||||
void targetChanged();
|
||||
void dataChanged();
|
||||
void enabledChanged();
|
||||
void drop(int action);
|
||||
void supportedActionsChanged();
|
||||
void defaultActionChanged();
|
||||
void delegateChanged();
|
||||
void sourceChanged();
|
||||
void targetChanged();
|
||||
void dataChanged();
|
||||
void enabledChanged();
|
||||
void drop(int action);
|
||||
void supportedActionsChanged();
|
||||
void defaultActionChanged();
|
||||
void startDragDistanceChanged();
|
||||
void delegateImageChanged();
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *) {}
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {}
|
||||
bool sceneEventFilter(QGraphicsItem *item, QEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *) {}
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {}
|
||||
bool sceneEventFilter(QGraphicsItem *item, QEvent *event);
|
||||
|
||||
private:
|
||||
QDeclarativeComponent* m_delegate;
|
||||
QDeclarativeItem* m_source;
|
||||
QDeclarativeItem* m_target;
|
||||
bool m_enabled;
|
||||
Qt::DropActions m_supportedActions;
|
||||
Qt::DropAction m_defaultAction;
|
||||
DeclarativeMimeData* const m_data;
|
||||
QDeclarativeComponent* m_delegate;
|
||||
QDeclarativeItem* m_source;
|
||||
QDeclarativeItem* m_target;
|
||||
bool m_enabled;
|
||||
Qt::DropActions m_supportedActions;
|
||||
Qt::DropAction m_defaultAction;
|
||||
DeclarativeMimeData* const m_data;
|
||||
QImage m_delegateImage;
|
||||
int m_startDragDistance;
|
||||
};
|
||||
|
@ -1,42 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "DeclarativeDragDropEvent.h"
|
||||
|
||||
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, QObject* parent) :
|
||||
QObject(parent),
|
||||
m_x(e->pos().x()),
|
||||
m_y(e->pos().y()),
|
||||
m_buttons(e->buttons()),
|
||||
m_modifiers(e->modifiers()),
|
||||
m_data(e->mimeData()),
|
||||
m_event(e)
|
||||
QObject(parent),
|
||||
m_x(e->pos().x()),
|
||||
m_y(e->pos().y()),
|
||||
m_buttons(e->buttons()),
|
||||
m_modifiers(e->modifiers()),
|
||||
m_data(e->mimeData()),
|
||||
m_event(e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DeclarativeDragDropEvent::accept(int action)
|
||||
{
|
||||
m_event->setDropAction( (Qt::DropAction) action );
|
||||
m_event->accept();
|
||||
m_event->setDropAction( (Qt::DropAction) action );
|
||||
m_event->accept();
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DECLARATIVEDRAGDROPEVENT_H
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "DeclarativeDropArea.h"
|
||||
@ -28,41 +28,41 @@
|
||||
#include <QMimeData>
|
||||
|
||||
DeclarativeDropArea::DeclarativeDropArea(QDeclarativeItem *parent)
|
||||
: QDeclarativeItem(parent),
|
||||
m_enabled(true)
|
||||
: QDeclarativeItem(parent),
|
||||
m_enabled(true)
|
||||
{
|
||||
setAcceptDrops(m_enabled);
|
||||
setAcceptDrops(m_enabled);
|
||||
}
|
||||
|
||||
void DeclarativeDropArea::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit dragEnter(&dde);
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit dragEnter(&dde);
|
||||
}
|
||||
|
||||
void DeclarativeDropArea::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit dragLeave(&dde);
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit dragLeave(&dde);
|
||||
}
|
||||
|
||||
void DeclarativeDropArea::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit drop(&dde);
|
||||
DeclarativeDragDropEvent dde(event, this);
|
||||
emit drop(&dde);
|
||||
}
|
||||
|
||||
bool DeclarativeDropArea::isEnabled() const
|
||||
{
|
||||
return m_enabled;
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
void DeclarativeDropArea::setEnabled(bool enabled)
|
||||
{
|
||||
if (enabled == m_enabled) {
|
||||
return;
|
||||
}
|
||||
if (enabled == m_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_enabled = enabled;
|
||||
setAcceptDrops(m_enabled);
|
||||
emit enabledChanged();
|
||||
m_enabled = enabled;
|
||||
setAcceptDrops(m_enabled);
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DECLARATIVEDROPAREA_H
|
||||
|
@ -1,86 +1,86 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "DeclarativeMimeData.h"
|
||||
|
||||
/*!
|
||||
\qmlclass MimeData DeclarativeMimeData
|
||||
\qmlclass MimeData DeclarativeMimeData
|
||||
|
||||
This is a wrapper class around QMimeData, with a few extensions to provide better support for in-qml drag & drops.
|
||||
This is a wrapper class around QMimeData, with a few extensions to provide better support for in-qml drag & drops.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\class DeclarativeMimeData
|
||||
\internal
|
||||
\class DeclarativeMimeData
|
||||
|
||||
Creates a new DeclarativeMimeData by cloning the QMimeData passed as parameter.
|
||||
This is useful for two reasons :
|
||||
- In DragArea, we want to clone our "working copy" of the DeclarativeMimeData instance, as Qt will automatically
|
||||
delete it after the drag and drop operation.
|
||||
- In the drop events, the QMimeData is const, and we have troubles passing const to QML. So we clone it to
|
||||
remove the "constness"
|
||||
Creates a new DeclarativeMimeData by cloning the QMimeData passed as parameter.
|
||||
This is useful for two reasons :
|
||||
- In DragArea, we want to clone our "working copy" of the DeclarativeMimeData instance, as Qt will automatically
|
||||
delete it after the drag and drop operation.
|
||||
- In the drop events, the QMimeData is const, and we have troubles passing const to QML. So we clone it to
|
||||
remove the "constness"
|
||||
|
||||
This method will try to cast the QMimeData to DeclarativeMimeData, and will clone our extensions to QMimeData as well
|
||||
This method will try to cast the QMimeData to DeclarativeMimeData, and will clone our extensions to QMimeData as well
|
||||
*/
|
||||
DeclarativeMimeData::DeclarativeMimeData(const QMimeData* copy)
|
||||
: QMimeData(),
|
||||
m_source(0)
|
||||
: QMimeData(),
|
||||
m_source(0)
|
||||
{
|
||||
// Copy the standard MIME data
|
||||
foreach(QString format, copy->formats()) {
|
||||
this->setData(format, copy->data(format));
|
||||
}
|
||||
// Copy the standard MIME data
|
||||
foreach(QString format, copy->formats()) {
|
||||
this->setData(format, copy->data(format));
|
||||
}
|
||||
|
||||
// If the object we are copying actually is a DeclarativeMimeData, copy our extended properties as well
|
||||
const DeclarativeMimeData* declarativeMimeData = qobject_cast<const DeclarativeMimeData*>(copy);
|
||||
if (declarativeMimeData) {
|
||||
this->setSource(declarativeMimeData->source());
|
||||
}
|
||||
// If the object we are copying actually is a DeclarativeMimeData, copy our extended properties as well
|
||||
const DeclarativeMimeData* declarativeMimeData = qobject_cast<const DeclarativeMimeData*>(copy);
|
||||
if (declarativeMimeData) {
|
||||
this->setSource(declarativeMimeData->source());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\qmlproperty url MimeData::url
|
||||
\qmlproperty url MimeData::url
|
||||
|
||||
Returns the first URL from the urls property of QMimeData
|
||||
TODO: We should use QDeclarativeListProperty<QUrls> to return the whole list instead of only the first element.
|
||||
Returns the first URL from the urls property of QMimeData
|
||||
TODO: We should use QDeclarativeListProperty<QUrls> to return the whole list instead of only the first element.
|
||||
*/
|
||||
QUrl DeclarativeMimeData::url() const
|
||||
{
|
||||
if ( this->hasUrls() && !this->urls().isEmpty()) {
|
||||
return QMimeData::urls().first();
|
||||
}
|
||||
return QUrl();
|
||||
if ( this->hasUrls() && !this->urls().isEmpty()) {
|
||||
return QMimeData::urls().first();
|
||||
}
|
||||
return QUrl();
|
||||
}
|
||||
void DeclarativeMimeData::setUrl(const QUrl &url)
|
||||
{
|
||||
if (this->url() == url)
|
||||
return;
|
||||
if (this->url() == url)
|
||||
return;
|
||||
|
||||
QList<QUrl> urlList;
|
||||
urlList.append(url);
|
||||
QMimeData::setUrls(urlList);
|
||||
emit urlChanged();
|
||||
QList<QUrl> urlList;
|
||||
urlList.append(url);
|
||||
QMimeData::setUrls(urlList);
|
||||
emit urlChanged();
|
||||
}
|
||||
|
||||
QVariantList DeclarativeMimeData::urls() const
|
||||
@ -105,17 +105,17 @@ void DeclarativeMimeData::setUrls(const QVariantList &urls)
|
||||
// color
|
||||
QColor DeclarativeMimeData::color() const
|
||||
{
|
||||
if ( this->hasColor()) {
|
||||
return qvariant_cast<QColor>(this->colorData());
|
||||
}
|
||||
return QColor();
|
||||
if ( this->hasColor()) {
|
||||
return qvariant_cast<QColor>(this->colorData());
|
||||
}
|
||||
return QColor();
|
||||
}
|
||||
void DeclarativeMimeData::setColor(const QColor &color)
|
||||
{
|
||||
if (this->color() != color) {
|
||||
this->setColorData(color);
|
||||
emit colorChanged();
|
||||
}
|
||||
if (this->color() != color) {
|
||||
this->setColorData(color);
|
||||
emit colorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void DeclarativeMimeData::setData(const QString &mimeType, const QString &data)
|
||||
@ -134,12 +134,12 @@ void DeclarativeMimeData::setData(const QString &mimeType, const QString &data)
|
||||
*/
|
||||
QDeclarativeItem* DeclarativeMimeData::source() const
|
||||
{
|
||||
return m_source;
|
||||
return m_source;
|
||||
}
|
||||
void DeclarativeMimeData::setSource(QDeclarativeItem* source)
|
||||
{
|
||||
if (m_source != source) {
|
||||
m_source = source;
|
||||
emit sourceChanged();
|
||||
}
|
||||
if (m_source != source) {
|
||||
m_source = source;
|
||||
emit sourceChanged();
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DECLARATIVEMIMEDATA_H
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
class DeclarativeMimeData : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* A plain text (MIME type text/plain) representation of the data.
|
||||
@ -63,41 +63,41 @@ class DeclarativeMimeData : public QMimeData
|
||||
* The graphical item on the scene that started the drag event. It may be null.
|
||||
*/
|
||||
Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged)
|
||||
//TODO: Image property
|
||||
//TODO: Image property
|
||||
|
||||
public:
|
||||
DeclarativeMimeData() : QMimeData() {}
|
||||
DeclarativeMimeData(const QMimeData* copy);
|
||||
DeclarativeMimeData() : QMimeData() {}
|
||||
DeclarativeMimeData(const QMimeData* copy);
|
||||
|
||||
QUrl url() const;
|
||||
void setUrl(const QUrl &url);
|
||||
QUrl url() const;
|
||||
void setUrl(const QUrl &url);
|
||||
|
||||
QVariantList urls() const;
|
||||
void setUrls(const QVariantList &urls);
|
||||
|
||||
QColor color() const;
|
||||
void setColor(const QColor &color);
|
||||
QColor color() const;
|
||||
void setColor(const QColor &color);
|
||||
|
||||
Q_INVOKABLE void setData(const QString &mimeType, const QString &data);
|
||||
|
||||
QDeclarativeItem* source() const;
|
||||
void setSource(QDeclarativeItem* source);
|
||||
QDeclarativeItem* source() const;
|
||||
void setSource(QDeclarativeItem* source);
|
||||
|
||||
|
||||
/*
|
||||
QString text() const; //TODO: Reimplement this to issue the onChanged signals
|
||||
void setText(const QString &text);
|
||||
QString html() const;
|
||||
void setHtml(const QString &html);
|
||||
*/
|
||||
/*
|
||||
QString text() const; //TODO: Reimplement this to issue the onChanged signals
|
||||
void setText(const QString &text);
|
||||
QString html() const;
|
||||
void setHtml(const QString &html);
|
||||
*/
|
||||
|
||||
signals:
|
||||
void textChanged(); //FIXME not being used
|
||||
void htmlChanged(); //FIXME not being used
|
||||
void urlChanged();
|
||||
void textChanged(); //FIXME not being used
|
||||
void htmlChanged(); //FIXME not being used
|
||||
void urlChanged();
|
||||
void urlsChanged();
|
||||
void colorChanged();
|
||||
void sourceChanged();
|
||||
void colorChanged();
|
||||
void sourceChanged();
|
||||
|
||||
private:
|
||||
QDeclarativeItem* m_source;
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
Copyright 2011 by Marco Martin <mart@kde.org>
|
||||
Copyright 2011 by Marco Martin <mart@kde.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "draganddropplugin.h"
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
Copyright 2011 by Marco Martin <mart@kde.org>
|
||||
Copyright 2011 by Marco Martin <mart@kde.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DRAGANDDROPPLUGIN_H
|
||||
@ -27,10 +27,10 @@
|
||||
|
||||
class DragAndDropPlugin : public QDeclarativeExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user