mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 01:04:06 +02:00
Address shutdown crash
This commit is contained in:
parent
8e8e23452f
commit
b63e4b9d1f
1 changed files with 9 additions and 2 deletions
|
@ -124,18 +124,25 @@ void VrMenu::addMenu(QMenu* menu) {
|
|||
new MenuUserData(menu, result);
|
||||
auto menuAction = menu->menuAction();
|
||||
updateQmlItemFromAction(result, menuAction);
|
||||
QObject::connect(menuAction, &QAction::changed, [=] {
|
||||
auto connection = QObject::connect(menuAction, &QAction::changed, [=] {
|
||||
updateQmlItemFromAction(result, menuAction);
|
||||
});
|
||||
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [=] {
|
||||
QObject::disconnect(connection);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void bindActionToQmlAction(QObject* qmlAction, QAction* action) {
|
||||
new MenuUserData(action, qmlAction);
|
||||
updateQmlItemFromAction(qmlAction, action);
|
||||
QObject::connect(action, &QAction::changed, [=] {
|
||||
auto connection = QObject::connect(action, &QAction::changed, [=] {
|
||||
updateQmlItemFromAction(qmlAction, action);
|
||||
});
|
||||
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [=] {
|
||||
QObject::disconnect(connection);
|
||||
});
|
||||
|
||||
QObject::connect(action, &QAction::toggled, [=](bool checked) {
|
||||
qmlAction->setProperty("checked", checked);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue