Skip to content

Commit

Permalink
Fix items not cleared #104
Browse files Browse the repository at this point in the history
  • Loading branch information
DamirPorobic committed Jun 4, 2020
1 parent a47b281 commit 35c70ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/widgets/menuButtons/GridMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,16 @@ void kImageAnnotator::GridMenu::buttonClicked()
emit selectionChanged();
}

void GridMenu::clear()
{
auto buttons = mButtonGroup->buttons();
for(auto button : buttons) {
mButtonGroup->removeButton(button);
mLayout->removeWidget(button);
}
qDeleteAll(buttons);
QMenu::clear();
emit selectionChanged();
}

} // namespace kImageAnnotator
1 change: 1 addition & 0 deletions src/widgets/menuButtons/GridMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Q_OBJECT
QIcon currentIcon() const;
QVariant currentData() const;
QString currentToolTip() const;
void clear();

signals:
void selectionChanged();
Expand Down

0 comments on commit 35c70ec

Please sign in to comment.