wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DragDropPayload.h File Reference

Shared reader for wiRedPanda's drag-and-drop MIME payload format. More...

#include <QPoint>
#include <QString>
#include "App/Core/Enums.h"
Include dependency graph for DragDropPayload.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DragDropPayload
 Decoded contents of a wiRedPanda drag-and-drop MIME payload. More...

Functions

DragDropPayload readDragDropPayload (QDataStream &stream)
 Reads a drag-and-drop payload from stream.

Detailed Description

Shared reader for wiRedPanda's drag-and-drop MIME payload format.

Definition in file DragDropPayload.h.

Function Documentation

◆ readDragDropPayload()

DragDropPayload readDragDropPayload ( QDataStream & stream)

Reads a drag-and-drop payload from stream.

Parameters
streamStream positioned just past Serialization::readPandaHeader().
Returns
The decoded payload.

Bounds icFileName and blobName via Serialization::readBoundedString() — the drag source is not a trusted process (any application can offer wiRedPanda's public MIME type with a crafted payload), so these must not use Qt's raw, unbounded QDataStream::operator>>(QString&). The optional trailing isEmbedded/blobName fields are read only if present, preserving compatibility with payloads that predate them.

Definition at line 10 of file DragDropPayload.cpp.

References DragDropPayload::blobName, DragDropPayload::icFileName, DragDropPayload::isEmbedded, DragDropPayload::offset, Serialization::readBoundedString(), and DragDropPayload::type.

Referenced by SceneDropHandler::addFromMimeData(), TrashButton::dropEvent(), and SceneDropHandler::handleNewElementDrop().