Allow click on a submenu-creating item.
This commit is contained in:
parent
0a0e5e1258
commit
a3b3745d7c
1 changed files with 13 additions and 2 deletions
|
|
@ -367,8 +367,19 @@ void Menu::mouseReleaseEvent(QMouseEvent *e) {
|
|||
|
||||
void Menu::handleMousePress(QPoint globalPosition) {
|
||||
handleMouseMove(globalPosition);
|
||||
if (_mousePressDelegate) {
|
||||
_mousePressDelegate(globalPosition);
|
||||
const auto margins = style::margins(0, _st.skip, 0, _st.skip);
|
||||
const auto inner = rect().marginsRemoved(margins);
|
||||
const auto localPosition = mapFromGlobal(globalPosition);
|
||||
const auto pressed = (inner.contains(localPosition)
|
||||
&& _lastSelectedByMouse)
|
||||
? findSelectedAction()
|
||||
: nullptr;
|
||||
if (pressed) {
|
||||
pressed->setClicked();
|
||||
} else {
|
||||
if (_mousePressDelegate) {
|
||||
_mousePressDelegate(globalPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue