mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
general function to load QML for javascript for tablet
(cherry picked from commit b50e20c545
)
This commit is contained in:
parent
4554d8ba68
commit
7db86204d1
2 changed files with 11 additions and 1 deletions
|
@ -212,6 +212,14 @@ void TabletProxy::gotoMenuScreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabletProxy::loadQMLSource(const QVariant& path) {
|
||||||
|
if (_qmlTabletRoot) {
|
||||||
|
if (_state != State::QML) {
|
||||||
|
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, path));
|
||||||
|
_state = State::QML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void TabletProxy::gotoHomeScreen() {
|
void TabletProxy::gotoHomeScreen() {
|
||||||
if (_qmlTabletRoot) {
|
if (_qmlTabletRoot) {
|
||||||
if (_state != State::Home) {
|
if (_state != State::Home) {
|
||||||
|
|
|
@ -89,6 +89,8 @@ public:
|
||||||
Q_INVOKABLE void gotoWebScreen(const QString& url);
|
Q_INVOKABLE void gotoWebScreen(const QString& url);
|
||||||
Q_INVOKABLE void gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl);
|
Q_INVOKABLE void gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl);
|
||||||
|
|
||||||
|
Q_INVOKABLE void loadQMLSource(const QVariant& path);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Creates a new button, adds it to this and returns it.
|
* Creates a new button, adds it to this and returns it.
|
||||||
* @function TabletProxy#addButton
|
* @function TabletProxy#addButton
|
||||||
|
@ -149,7 +151,7 @@ protected:
|
||||||
QQuickItem* _qmlTabletRoot { nullptr };
|
QQuickItem* _qmlTabletRoot { nullptr };
|
||||||
QObject* _qmlOffscreenSurface { nullptr };
|
QObject* _qmlOffscreenSurface { nullptr };
|
||||||
|
|
||||||
enum class State { Uninitialized, Home, Web, Menu };
|
enum class State { Uninitialized, Home, Web, Menu, QML };
|
||||||
State _state { State::Uninitialized };
|
State _state { State::Uninitialized };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue