Ability to disable window move when dragging menu buttons
In Issue #2, @emvaized asked if we could disable the "window drag" option.
It will need to:
- Add config option.
- Not call
initDragMove(event->pos());inDecoration::mousePressEventwhen config says so.- https://github.com/Zren/material-decoration/blame/master/src/Decoration.cc#L302
- Bind the
AppMenuButton::pressedsignal to theAppMenuButton::clickedsignal. In thepressedsignal handler, check if the config option is set, then emit the clicked signal.- https://github.com/Zren/material-decoration/blob/master/src/AppMenuButton.cc
- https://invent.kde.org/plasma/kdecoration/-/blob/master/src/decorationbutton.h
- https://invent.kde.org/plasma/kdecoration/-/blob/master/src/decorationbutton.cpp
You'd need to write a new function to handle the AppMenuButton::pressed signal.
In the AppMenuButton constructor(AppMenuButton::AppMenuButton), we need to connect(...) a signal to another signal. I'm not sure if Qt's connect functions supports that, so we'll just create an anonymous "slot" function, that emits the other signal. I'll need the slot function anyways since I'll need to check the config first to see if I need to emit the clicked signal.
Here's an example which I have NOT tested.
connect(this, &AppMenuButton::pressed,
[this] {
emit clicked();
}
);
connect(this, &AppMenuButton::clicked,
this, &AppMenuButton::trigger);
~~Eg:~~
- ~~https://github.com/Zren/material-decoration/blob/master/src/AppMenuButtonGroup.cc#L78~~
- ~~https://github.com/Zren/material-decoration/blob/master/src/AppMenuButtonGroup.cc#L108~~
What should be changed in setCurrentIndex method (line 108)?
Those were just examples of emit and an anonymous connect function. I wasn't planning on doing a complete example when I added the examples.
Oh, okay - got it!