Refresh toolbar only when needed

This commit is contained in:
manongjohn 2018-06-30 01:10:12 -04:00
parent e444f9b157
commit e2da56dae0
2 changed files with 6 additions and 0 deletions

View file

@ -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();
}

View file

@ -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);