mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 11:53:28 +02:00
general function to load QML for javascript for tablet
This commit is contained in:
parent
d75512f680
commit
b50e20c545
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() {
|
||||
if (_qmlTabletRoot) {
|
||||
if (_state != State::Home) {
|
||||
|
|
|
@ -89,6 +89,8 @@ public:
|
|||
Q_INVOKABLE void gotoWebScreen(const QString& url);
|
||||
Q_INVOKABLE void gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl);
|
||||
|
||||
Q_INVOKABLE void loadQMLSource(const QVariant& path);
|
||||
|
||||
/**jsdoc
|
||||
* Creates a new button, adds it to this and returns it.
|
||||
* @function TabletProxy#addButton
|
||||
|
@ -149,7 +151,7 @@ protected:
|
|||
QQuickItem* _qmlTabletRoot { nullptr };
|
||||
QObject* _qmlOffscreenSurface { nullptr };
|
||||
|
||||
enum class State { Uninitialized, Home, Web, Menu };
|
||||
enum class State { Uninitialized, Home, Web, Menu, QML };
|
||||
State _state { State::Uninitialized };
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue