Refresh toolbar only when needed
This commit is contained in:
parent
e444f9b157
commit
e2da56dae0
2 changed files with 6 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue