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;
|
||||
}
|
||||
if (const auto parent = parentWidget()) {
|
||||
if (QApplication::focusWidget() != nullptr
|
||||
const auto focused = QApplication::focusWidget();
|
||||
if (_reactivateParent
|
||||
&& focused != nullptr
|
||||
&& Ui::InFocusChain(parent->window())) {
|
||||
ActivateWindowDelayed(parent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ public:
|
|||
void setDestroyedCallback(Fn<void()> callback) {
|
||||
_destroyedCallback = std::move(callback);
|
||||
}
|
||||
void discardParentReActivate() {
|
||||
_reactivateParent = false;
|
||||
}
|
||||
|
||||
~PopupMenu();
|
||||
|
||||
|
|
@ -122,6 +125,7 @@ private:
|
|||
bool _deleteOnHide = true;
|
||||
bool _triggering = false;
|
||||
bool _deleteLater = false;
|
||||
bool _reactivateParent = true;
|
||||
|
||||
Fn<void()> _destroyedCallback;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue