mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Fix QML warnings at shutdown
This commit is contained in:
parent
7b49552066
commit
8f6cfb72ea
7 changed files with 57 additions and 8 deletions
|
@ -17,7 +17,7 @@ import "windows"
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
anchors.centerIn: parent
|
|
||||||
objectName: "AddressBarDialog"
|
objectName: "AddressBarDialog"
|
||||||
frame: HiddenFrame {}
|
frame: HiddenFrame {}
|
||||||
|
|
||||||
|
@ -29,6 +29,19 @@ Window {
|
||||||
width: addressBarDialog.implicitWidth
|
width: addressBarDialog.implicitWidth
|
||||||
height: addressBarDialog.implicitHeight
|
height: addressBarDialog.implicitHeight
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
root.parentChanged.connect(center);
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
root.parentChanged.disconnect(center);
|
||||||
|
}
|
||||||
|
|
||||||
|
function center() {
|
||||||
|
// Explicitly center in order to avoid warnings at shutdown
|
||||||
|
anchors.centerIn = parent;
|
||||||
|
}
|
||||||
|
|
||||||
AddressBarDialog {
|
AddressBarDialog {
|
||||||
id: addressBarDialog
|
id: addressBarDialog
|
||||||
implicitWidth: backgroundImage.width
|
implicitWidth: backgroundImage.width
|
||||||
|
|
|
@ -3,10 +3,24 @@ import QtQuick 2.3
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
id: stats
|
||||||
|
|
||||||
anchors.leftMargin: 300
|
anchors.leftMargin: 300
|
||||||
objectName: "StatsItem"
|
objectName: "StatsItem"
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
stats.parentChanged.connect(fill);
|
||||||
|
fill();
|
||||||
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
stats.parentChanged.disconnect(fill);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill() {
|
||||||
|
// Explicitly fill in order to avoid warnings at shutdown
|
||||||
|
anchors.fill = parent;
|
||||||
|
}
|
||||||
|
|
||||||
Hifi.Stats {
|
Hifi.Stats {
|
||||||
id: root
|
id: root
|
||||||
objectName: "Stats"
|
objectName: "Stats"
|
||||||
|
|
|
@ -248,9 +248,15 @@ Fadable {
|
||||||
|
|
||||||
children: [ swallower, frame, pane, activator ]
|
children: [ swallower, frame, pane, activator ]
|
||||||
|
|
||||||
Component.onCompleted: { raise(); setDefaultFocus(); }
|
Component.onCompleted: {
|
||||||
Component.onDestruction: windowDestroyed();
|
window.parentChanged.connect(raise);
|
||||||
onParentChanged: raise();
|
raise();
|
||||||
|
setDefaultFocus();
|
||||||
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
window.parentChanged.disconnect(raise); // Prevent warning on shutdown
|
||||||
|
windowDestroyed();
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible && destroyOnInvisible) {
|
if (!visible && destroyOnInvisible) {
|
||||||
|
|
|
@ -114,9 +114,14 @@ Fadable {
|
||||||
|
|
||||||
children: [ swallower, frame, content, activator ]
|
children: [ swallower, frame, content, activator ]
|
||||||
|
|
||||||
Component.onCompleted: raise();
|
Component.onCompleted: {
|
||||||
Component.onDestruction: windowDestroyed();
|
window.parentChanged.connect(raise);
|
||||||
onParentChanged: raise();
|
raise();
|
||||||
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
window.parentChanged.disconnect(raise); // Prevent warning on shutdown
|
||||||
|
windowDestroyed();
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible && destroyOnInvisible) {
|
if (!visible && destroyOnInvisible) {
|
||||||
|
|
|
@ -1150,6 +1150,9 @@ void Application::aboutToQuit() {
|
||||||
|
|
||||||
getActiveDisplayPlugin()->deactivate();
|
getActiveDisplayPlugin()->deactivate();
|
||||||
|
|
||||||
|
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
|
||||||
|
DependencyManager::get<OffscreenUi>()->hide("RunningScripts");
|
||||||
|
|
||||||
_aboutToQuit = true;
|
_aboutToQuit = true;
|
||||||
|
|
||||||
cleanupBeforeQuit();
|
cleanupBeforeQuit();
|
||||||
|
|
|
@ -143,6 +143,13 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OffscreenUi::hide(const QString& name) {
|
||||||
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
|
if (item) {
|
||||||
|
item->setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ModalDialogListener : public QObject {
|
class ModalDialogListener : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class OffscreenUi;
|
friend class OffscreenUi;
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
virtual void create(QOpenGLContext* context) override;
|
virtual void create(QOpenGLContext* context) override;
|
||||||
void createDesktop(const QUrl& url);
|
void createDesktop(const QUrl& url);
|
||||||
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
|
void hide(const QString& name);
|
||||||
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
bool shouldSwallowShortcut(QEvent* event);
|
bool shouldSwallowShortcut(QEvent* event);
|
||||||
bool navigationFocused();
|
bool navigationFocused();
|
||||||
|
|
Loading…
Reference in a new issue