Removed redundant hasSubmenu property from menu item base.
This commit is contained in:
parent
43f09755e5
commit
0ce0766b5e
4 changed files with 6 additions and 14 deletions
|
|
@ -65,7 +65,6 @@ Action::Action(
|
|||
|
||||
initResizeHook(parent->sizeValue());
|
||||
processAction();
|
||||
setHasSubmenu(action->menu() != nullptr);
|
||||
|
||||
paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
|
|
@ -78,6 +77,10 @@ Action::Action(
|
|||
connect(_action, &QAction::changed, [=] { processAction(); });
|
||||
}
|
||||
|
||||
bool Action::hasSubmenu() const {
|
||||
return _action->menu() != nullptr;
|
||||
}
|
||||
|
||||
void Action::paint(Painter &p) {
|
||||
const auto enabled = _action->isEnabled();
|
||||
const auto selected = isSelected();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ private:
|
|||
void processAction();
|
||||
void paint(Painter &p);
|
||||
|
||||
bool hasSubmenu() const;
|
||||
|
||||
Text::String _text;
|
||||
QString _shortcut;
|
||||
const not_null<QAction*> _action;
|
||||
|
|
|
|||
|
|
@ -77,14 +77,6 @@ int ItemBase::minWidth() const {
|
|||
return _minWidth.current();
|
||||
}
|
||||
|
||||
bool ItemBase::hasSubmenu() const {
|
||||
return _hasSubmenu;
|
||||
}
|
||||
|
||||
void ItemBase::setHasSubmenu(bool value) {
|
||||
_hasSubmenu = value;
|
||||
}
|
||||
|
||||
void ItemBase::init() {
|
||||
events(
|
||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ public:
|
|||
int minWidth() const;
|
||||
void setMinWidth(int w);
|
||||
|
||||
bool hasSubmenu() const;
|
||||
void setHasSubmenu(bool value);
|
||||
|
||||
virtual void handleKeyPress(not_null<QKeyEvent*> e) {
|
||||
}
|
||||
|
||||
|
|
@ -58,8 +55,6 @@ protected:
|
|||
private:
|
||||
int _index = -1;
|
||||
|
||||
bool _hasSubmenu = false;
|
||||
|
||||
rpl::variable<bool> _selected = false;
|
||||
rpl::event_stream<> _clicks;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue