16#include <QDragEnterEvent>
44 setAutoFillBackground(
true);
46 setMouseTracking(
true);
83 const QMimeData *data =
event->mimeData();
87 data->hasFormat(
"image/svg+xml"))
89 if (data->hasFormat(
"image/svg+xml")) {
94 canvas->shapeController()->documentRectInPixels(),
95 canvas->shapeController()->pixelsPerInch(),
98 if (!shapes.isEmpty()) {
104 bool isTemplate =
true;
115 QDataStream dataStream(&itemData, QIODevice::ReadOnly);
120 dataStream >> properties;
124 dataStream >> offset;
130 warnFlake <<
"Application requested a shape that is not registered '" <<
137 props.
load(properties);
149 event->setDropAction(Qt::CopyAction);
162 if (!allShapes.isEmpty()) {
241 updateRect.adjust(-2, -2, 2, 2);
264 painter.setOpacity(0.6);
265 painter.setRenderHint(QPainter::Antialiasing);
274 const int viewH = size().height();
275 const int viewW = size().width();
278 QRect geom = QRect(0, 0, viewW, viewH);
#define SHAPETEMPLATE_MIMETYPE
KisCoordinatesConverter * coordinatesConverter
_Private::Traits< T >::Result widgetToDocument(const T &obj) const
_Private::Traits< T >::Result documentToWidget(const T &obj) const
const T value(const QString &id) const
void load(const QDomElement &root)
void deselectAll()
clear the selections list
void select(KoShape *shape)
const QList< KoShape * > selectedShapes() const
KoShapeLayer * activeLayer() const
virtual KoShape * createDefaultShape(KoDocumentResourceManager *documentResources=0) const
virtual KoShape * createShape(const KoProperties *params, KoDocumentResourceManager *documentResources=0) const
static KoShapeRegistry * instance()
void setZIndex(qint16 zIndex)
virtual bool isShapeEditable(bool recursive=true) const
checks recursively if the shape or one of its parents is not visible or locked
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
bool isGeometryProtected() const
virtual QRectF boundingRect() const
Get the bounding box of the shape.
virtual void update() const
virtual void paint(QPainter &painter) const =0
Paint the shape fill The class extending this one is responsible for painting itself....
virtual void setPosition(const QPointF &position)
Set the position of the shape in pt.
void setShapeId(const QString &id)
void setAbsolutePosition(const QPointF &newPosition, KoFlake::AnchorPosition anchor=KoFlake::Center)
static const qint16 maxZIndex
static QList< KoShape * > fetchShapesFromData(const QByteArray &data, QRectF viewportInPx, qreal resolutionPPI, QSizeF *fragmentSize=nullptr)
virtual QPointF documentToView(const QPointF &documentPoint) const
void handleDragEnterEvent(QDragEnterEvent *event)
void handleDragLeaveEvent(QDragLeaveEvent *event)
void handleDropEvent(QDropEvent *event)
KoCanvasControllerWidget * m_parent
Viewport(KoCanvasControllerWidget *parent)
void handleDragMoveEvent(QDragMoveEvent *event)
void setCanvas(QWidget *canvas)
QPointF correctPosition(const QPoint &point) const
void repaint(KoShape *shape)
void handlePaintEvent(QPainter &gc, QPaintEvent *event)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)