Commit 3723b4c0 authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Fixed a bug on undoing removal of last assistant

Undoing the removal of the last assistant will not make the
removed assistant show up again. This is due to the removal
of the last assistant in `KisPaintingAssistantsDecoration`
will `setVisible(false)`, but the undo command has yet to
revert this.

This commit involves API changes in
`KisPaintingAssistantsDecoration`.
parent 3b411b2f
......@@ -120,6 +120,17 @@ void KisPaintingAssistantsDecoration::removeAll()
emit assistantChanged();
}
void KisPaintingAssistantsDecoration::setAssistants(const QList<KisPaintingAssistantSP> &assistants)
{
Q_FOREACH (KisPaintingAssistantSP assistant, assistants) {
assistant->setAssistantGlobalColorCache(view()->document()->assistantsGlobalColor());
}
view()->document()->setAssistants(assistants);
setVisible(!assistants.isEmpty());
emit assistantChanged();
}
QPointF KisPaintingAssistantsDecoration::adjustPosition(const QPointF& point, const QPointF& strokeBegin)
{
......
......@@ -64,6 +64,7 @@ public:
void addAssistant(KisPaintingAssistantSP assistant);
void removeAssistant(KisPaintingAssistantSP assistant);
void removeAll();
void setAssistants(const QList<KisPaintingAssistantSP> &assistants);
QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
void endStroke();
QList<KisPaintingAssistantHandleSP> handles();
......
......@@ -68,7 +68,7 @@ void EditAssistantsCommand::replaceWith(AssistantSPList assistants, Type type)
}
}
m_canvas->imageView()->document()->setAssistants(assistants);
m_canvas->paintingAssistantsDecoration()->setAssistants(assistants);
Q_FOREACH (KisPaintingAssistantSP assistant, assistants) {
assistant->uncache();
......
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