Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions framework/uicomponents/qml/Muse/UiComponents/windowview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ void WindowView::init()
});

navigationController()->navigationChanged().onNotify(this, [this]() {
updateNavigationParentControl();

if (!(m_focusPolicies & FocusPolicy::TabFocus)) {
return;
}
Expand Down Expand Up @@ -528,23 +530,44 @@ void WindowView::setNavigationParentControl(ui::INavigationControl* navigationPa
return;
}

QObject* oldCtrl = dynamic_cast<QObject*>(m_navigationParentControl);

if (oldCtrl) {
disconnect(oldCtrl, &QObject::destroyed, this, nullptr);
}

m_navigationParentControl = navigationParentControl;

//! NOTE At the moment we have only qml navigation controls
QObject* qmlCtrl = dynamic_cast<QObject*>(navigationParentControl);

if (qmlCtrl) {
connect(qmlCtrl, &QObject::destroyed, this, [this]() {
m_navigationParentControl = nullptr;
emit navigationParentControlChanged(nullptr);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

emit navigationParentControlChanged(m_navigationParentControl);
}

void WindowView::resolveNavigationParentControl()
{
ui::INavigationControl* ctrl = navigationController()->activeControl();
setNavigationParentControl(ctrl);
setNavigationParentControl(navigationController()->activeControl());
}

//! NOTE At the moment we have only qml navigation controls
QObject* qmlCtrl = dynamic_cast<QObject*>(ctrl);
void WindowView::updateNavigationParentControl()
{
if (!isOpened() || !m_parentWindow) {
return;
}

if (qmlCtrl) {
connect(qmlCtrl, &QObject::destroyed, this, [this]() {
setNavigationParentControl(nullptr);
});
ui::INavigationControl* activeControl = navigationController()->activeControl();
if (!activeControl || activeControl->window() != m_parentWindow) {
return;
}

setNavigationParentControl(activeControl);
}

void WindowView::activateNavigationParentControl()
Expand Down
1 change: 1 addition & 0 deletions framework/uicomponents/qml/Muse/UiComponents/windowview.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public slots:
void updateSize(const QSize& newSize);

void resolveNavigationParentControl();
void updateNavigationParentControl();
void activateNavigationParentControl();

QQmlEngine* m_engine = nullptr;
Expand Down