fix mouse cursor stolen by mouse area

This commit is contained in:
Gaelle Braud 2024-11-13 11:44:45 +01:00
parent dfe0c5cbe9
commit b25cf4ff15
2 changed files with 13 additions and 11 deletions

View file

@ -758,6 +758,10 @@ void App::setCoreStarted(bool started) {
}
}
static QObject *findParentWindow(QObject *item) {
return !item || item->isWindowType() ? item : findParentWindow(item->parent());
}
bool App::notify(QObject *receiver, QEvent *event) {
bool done = true;
try {
@ -767,6 +771,15 @@ bool App::notify(QObject *receiver, QEvent *event) {
} catch (...) {
lCritical() << log().arg("Generic exeption has been catch in notify");
}
if (event->type() == QEvent::MouseButtonPress) {
auto window = findParentWindow(receiver);
if (getMainWindow() == window) {
auto defaultAccountCore = mAccountList->getDefaultAccountCore();
if (defaultAccountCore && defaultAccountCore->getUnreadCallNotifications() > 0) {
emit defaultAccountCore->lResetMissedCalls();
}
}
}
return done;
}

View file

@ -78,17 +78,6 @@ Item {
sourceModel: AppCpp.calls
}
MouseArea {
anchors.fill: parent
focus: true
z: 100
onPressed: {
if (mainStackView.currentItem.objectName === "mainStackLayout" && mainStackView.currentItem.currentIndex === 0
&& accountProxy.defaultAccount && accountProxy.defaultAccount.core.unreadCallNotifications > 0) accountProxy.defaultAccount.core.lResetMissedCalls()
mouse.accepted = false
}
}
Item{
Popup {
id: currentCallNotif