Skip to content

Commit

Permalink
Allow changing menu action icons in realtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Nov 25, 2021
1 parent f4a32c3 commit 7256546
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ui/widgets/menu/menu_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,12 @@ void Action::handleKeyPress(not_null<QKeyEvent*> e) {
}
}

void Action::setIcon(
const style::icon *icon,
const style::icon *iconOver) {
_icon = icon;
_iconOver = iconOver ? iconOver : icon;
update();
}

} // namespace Ui::Menu
4 changes: 4 additions & 0 deletions ui/widgets/menu/menu_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class Action : public ItemBase {

void handleKeyPress(not_null<QKeyEvent*> e) override;

void setIcon(
const style::icon *icon,
const style::icon *iconOver = nullptr);

protected:
QPoint prepareRippleStartPosition() const override;
QImage prepareRippleMask() const override;
Expand Down

0 comments on commit 7256546

Please sign in to comment.