Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Refresh toolbar only when needed

manongjohne2da56dae06c
diff --git a/toonz/sources/toonz/toolbar.cpp b/toonz/sources/toonz/toolbar.cpp
index 45357a05a..cc4fa430a 100755
--- a/toonz/sources/toonz/toolbar.cpp
+++ b/toonz/sources/toonz/toolbar.cpp
@@ -190,6 +190,10 @@ void Toolbar::updateToolbar() {
}
}
+ if (levelType == m_toolbarLevel) return;
+
+ m_toolbarLevel = levelType;
+
// Hide action for now
for (int idx = 0; buttonLayout[idx].toolName; idx++) {
if (buttonLayout[idx].action) removeAction(buttonLayout[idx].action);
@@ -282,6 +286,7 @@ void Toolbar::updateToolbar() {
void Toolbar::setIsExpanded(bool expand) {
m_isExpanded = expand;
+ m_toolbarLevel = -1; // Force toolbar to refresh
ShowAllToolsToggle = (expand) ? 1 : 0;
updateToolbar();
}
diff --git a/toonz/sources/toonz/toolbar.h b/toonz/sources/toonz/toolbar.h
index 04b461982..6a3ad5a8e 100755
--- a/toonz/sources/toonz/toolbar.h
+++ b/toonz/sources/toonz/toolbar.h
@@ -14,6 +14,7 @@ class Toolbar final : public QToolBar {
QToolButton *m_expandButton;
QAction *m_expandAction;
bool m_isExpanded;
+ int m_toolbarLevel;
public:
Toolbar(QWidget *parent, bool isVertical = true);