wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DragDropPayload.cpp File Reference
#include "App/Core/DragDropPayload.h"
#include <QDataStream>
#include "App/IO/Serialization.h"
Include dependency graph for DragDropPayload.cpp:

Go to the source code of this file.

Functions

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

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().