Commit 9038e32c authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Show reference images correctly after switching snapshots

parent 53ff60a2
......@@ -101,6 +101,7 @@ KisReferenceImagesDecoration::KisReferenceImagesDecoration(QPointer<KisView> par
, d(new Private(this))
{
connect(document->image().data(), SIGNAL(sigNodeAddedAsync(KisNodeSP)), this, SLOT(slotNodeAdded(KisNodeSP)));
connect(document, &KisDocument::sigReferenceImagesLayerChanged, this, &KisReferenceImagesDecoration::slotNodeAdded);
auto referenceImageLayer = document->referenceImagesLayer();
if (referenceImageLayer) {
......@@ -165,9 +166,13 @@ void KisReferenceImagesDecoration::slotReferenceImagesChanged(const QRectF &dirt
void KisReferenceImagesDecoration::setReferenceImageLayer(KisSharedPtr<KisReferenceImagesLayer> layer)
{
d->layer = layer;
connect(
layer.data(), SIGNAL(sigUpdateCanvas(QRectF)),
this, SLOT(slotReferenceImagesChanged(QRectF))
);
if (d->layer.data() != layer.data()) {
if (d->layer) {
d->layer->disconnect(this);
}
d->layer = layer;
connect(layer.data(), SIGNAL(sigUpdateCanvas(QRectF)),
this, SLOT(slotReferenceImagesChanged(QRectF)));
slotReferenceImagesChanged(layer->extent());
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment