Commit ce50e5ce authored by Anna Medonosová's avatar Anna Medonosová

Check for view and document before setting mirror tool config

CCBUG:404852
parent cbf81220
......@@ -34,6 +34,7 @@ public:
, handleSize(32.f)
, horizontalHandlePosition(64.f)
, verticalHandlePosition(64.f)
, axisPosition(QPointF(0.f,0.f))
{}
bool operator==(const Private& rhs) {
......
......@@ -42,7 +42,6 @@ public:
{}
KisMirrorAxis* mirrorAxisDecoration;
// KisMirrorAxisConfig mirrorAxisConfig() {}
};
KisMirrorManager::KisMirrorManager(KisViewManager* view) : QObject(view)
......@@ -84,8 +83,9 @@ void KisMirrorManager::setView(QPointer<KisView> imageView)
m_imageView->canvasBase()->addDecoration(d->mirrorAxisDecoration);
}
d->mirrorAxisDecoration->setMirrorAxisConfig(mirrorAxisConfig());
setDecorationConfig();
}
updateAction();
}
......@@ -103,12 +103,12 @@ void KisMirrorManager::updateAction()
void KisMirrorManager::slotDocumentConfigChanged()
{
d->mirrorAxisDecoration->setMirrorAxisConfig(mirrorAxisConfig());
setDecorationConfig();
}
void KisMirrorManager::slotMirrorAxisConfigChanged()
{
if (m_imageView) {
if (m_imageView && m_imageView->document()) {
KisSignalsBlocker blocker(m_imageView->document());
m_imageView->document()->setMirrorAxisConfig(d->mirrorAxisDecoration->mirrorAxisConfig());
}
......@@ -122,7 +122,10 @@ KisMirrorAxis* KisMirrorManager::hasDecoration() {
return 0;
}
const KisMirrorAxisConfig& KisMirrorManager::mirrorAxisConfig() const
void KisMirrorManager::setDecorationConfig()
{
return m_imageView->document()->mirrorAxisConfig();
if (m_imageView && m_imageView->document()) {
KisMirrorAxisConfig config = m_imageView->document()->mirrorAxisConfig();
d->mirrorAxisDecoration->setMirrorAxisConfig(config);
}
}
......@@ -55,7 +55,7 @@ private:
QPointer<KisView> m_imageView;
QAction *m_mirrorCanvas;
KisMirrorAxis* hasDecoration();
const KisMirrorAxisConfig &mirrorAxisConfig() const;
void setDecorationConfig();
};
#endif // KIS__MANAGER_H
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