17#include "clipboardmanager.h"
20#include <QGuiApplication>
24ClipboardManager::ClipboardManager(
Editor* editor) :
BaseManager(editor,
"ClipboardManager")
29ClipboardManager::~ClipboardManager()
34void ClipboardManager::setFromSystemClipboard(
const QPointF& pos,
const Layer* layer)
42 if (layer->type() != Layer::BITMAP || clipboard->
ownsClipboard()) {
55 Q_ASSERT(bitmapImage !=
nullptr && bitmapImage->isLoaded());
59 mBitmapImage = bitmapImage->copy(selectionRect.
toRect());
63 mBitmapImage = bitmapImage->copy();
72 if (vectorImage ==
nullptr || vectorImage->isEmpty()) {
return; }
75 mVectorImage = *vectorImage->clone();
82 KeyFrame* keyframe = currentLayer->getKeyFrameAt(pos);
84 Q_ASSERT(keyframe !=
nullptr);
88 mFrames.insert(std::make_pair(keyframe->pos(), keyframe->clone()));
90 mFramesType = currentLayer->type();
98 mFramesType = Layer::LAYER_TYPE::UNDEFINED;
void copySelectedFrames(const Layer *currentLayer)
Copy selected keyframes of any given layer and remember its type.
void copyVectorImage(const VectorImage *vectorImage)
Copy the entire vector image to clipboard, this operation does not yet support partial selections.
void resetStates()
This should be called before copying and updating the clipboard to ensure no previous state is saved.
void copyBitmapImage(BitmapImage *image, QRectF selectionRect)
Copy bitmap image to clipboard and save its latest position Additionally only a part of the image wil...
QList< int > selectedKeyFramesPositions() const
Get selected keyframe positions sorted by position.
QImage image(QClipboard::Mode mode) const const
bool ownsClipboard() const const
void setImage(const QImage &image, QClipboard::Mode mode)
bool isNull() const const
QPoint toPoint() const const
bool isEmpty() const const
QRect toRect() const const