Allow PopupMenu not to reactivate parent window.
This commit is contained in:
parent
79ea651127
commit
3a05cdc11e
2 changed files with 7 additions and 1 deletions
|
|
@ -538,7 +538,9 @@ PopupMenu::~PopupMenu() {
|
||||||
delete submenu;
|
delete submenu;
|
||||||
}
|
}
|
||||||
if (const auto parent = parentWidget()) {
|
if (const auto parent = parentWidget()) {
|
||||||
if (QApplication::focusWidget() != nullptr
|
const auto focused = QApplication::focusWidget();
|
||||||
|
if (_reactivateParent
|
||||||
|
&& focused != nullptr
|
||||||
&& Ui::InFocusChain(parent->window())) {
|
&& Ui::InFocusChain(parent->window())) {
|
||||||
ActivateWindowDelayed(parent);
|
ActivateWindowDelayed(parent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ public:
|
||||||
void setDestroyedCallback(Fn<void()> callback) {
|
void setDestroyedCallback(Fn<void()> callback) {
|
||||||
_destroyedCallback = std::move(callback);
|
_destroyedCallback = std::move(callback);
|
||||||
}
|
}
|
||||||
|
void discardParentReActivate() {
|
||||||
|
_reactivateParent = false;
|
||||||
|
}
|
||||||
|
|
||||||
~PopupMenu();
|
~PopupMenu();
|
||||||
|
|
||||||
|
|
@ -122,6 +125,7 @@ private:
|
||||||
bool _deleteOnHide = true;
|
bool _deleteOnHide = true;
|
||||||
bool _triggering = false;
|
bool _triggering = false;
|
||||||
bool _deleteLater = false;
|
bool _deleteLater = false;
|
||||||
|
bool _reactivateParent = true;
|
||||||
|
|
||||||
Fn<void()> _destroyedCallback;
|
Fn<void()> _destroyedCallback;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue