OpenToonz - An open-source full-featured 2D animation creation software
C
#assistants: signal toolOptionsBoxChanged
Ivan Mahonincbbe07a0b7f9
diff --git a/toonz/sources/include/tools/toolhandle.h b/toonz/sources/include/tools/toolhandle.hindex 4bdf60bfa..427c2111d 100644--- a/toonz/sources/include/tools/toolhandle.h+++ b/toonz/sources/include/tools/toolhandle.h@@ -63,7 +63,7 @@ public:/*! Notify tool parameters change (out of toolOption bar).*/void notifyToolChanged() { emit toolChanged(); }-+ void notifyToolOptionsBoxChanged() { emit toolOptionsBoxChanged(); }void notifyToolCursorTypeChanged() { emit toolCursorTypeChanged(); }void notifyToolComboBoxListChanged(std::string id) {@@ -74,6 +74,7 @@ signals:void toolComboBoxListChanged(std::string);void toolSwitched();void toolChanged();+ void toolOptionsBoxChanged();void toolEditingFinished();// used for changing the tool cursor when the options changed with short cut// keys assigned for tool options.diff --git a/toonz/sources/include/tools/tooloptions.h b/toonz/sources/include/tools/tooloptions.hindex c66e36054..a4f712bc0 100644--- a/toonz/sources/include/tools/tooloptions.h+++ b/toonz/sources/include/tools/tooloptions.h@@ -776,7 +776,6 @@ public:class DVAPI ToolOptions final : public QFrame {Q_OBJECT- int m_width, m_height;std::map<TTool *, ToolOptionsBox *> m_panels;QWidget *m_panel;@@ -793,6 +792,7 @@ protected:public slots:void onToolSwitched();+ void onToolOptionsBoxChanged();void onToolChanged();void onStageObjectChange();diff --git a/toonz/sources/tnztools/editassistantstool.cpp b/toonz/sources/tnztools/editassistantstool.cppindex baa9f06dc..93b56ac27 100644--- a/toonz/sources/tnztools/editassistantstool.cpp+++ b/toonz/sources/tnztools/editassistantstool.cpp@@ -319,7 +319,7 @@ protected:public:void updateOptionsBox()- { /* getApplication()->getCurrentTool()->notifyToolOptionsBoxChanged(); */ }+ { getApplication()->getCurrentTool()->notifyToolOptionsBoxChanged(); }void resetCurrentPoint(bool updateOptionsBox = true) {close();diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cppindex c392c85d2..2ca4b7cc9 100644--- a/toonz/sources/tnztools/tooloptions.cpp+++ b/toonz/sources/tnztools/tooloptions.cpp@@ -2849,6 +2849,7 @@ void ToolOptions::showEvent(QShowEvent *) {if (currTool) {onToolSwitched();connect(currTool, SIGNAL(toolSwitched()), SLOT(onToolSwitched()));+ connect(currTool, SIGNAL(toolOptionsBoxChanged()), SLOT(onToolOptionsBoxChanged()));connect(currTool, SIGNAL(toolChanged()), SLOT(onToolChanged()));}@@ -2883,6 +2884,19 @@ void ToolOptions::hideEvent(QShowEvent *) {//-----------------------------------------------------------------------------+void ToolOptions::onToolOptionsBoxChanged() {+ TTool *tool = TTool::getApplication()->getCurrentTool()->getTool();+ std::map<TTool *, ToolOptionsBox *>::iterator it = m_panels.find(tool);+ if (it != m_panels.end()) {+ ToolOptionsBox *panel = it->second;+ m_panels.erase(it);+ layout()->removeWidget(panel);+ }+ onToolSwitched();+}++//-----------------------------------------------------------------------------+void ToolOptions::onToolSwitched() {if (m_panel) m_panel->hide();m_panel = 0;