mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:03:11 +02:00
Home button fix
This commit is contained in:
parent
0c2d08db4a
commit
a30ad2709b
2 changed files with 13 additions and 4 deletions
|
@ -44,7 +44,7 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm
|
||||||
|
|
||||||
static const char* TABLET_SOURCE_URL = "Tablet.qml";
|
static const char* TABLET_SOURCE_URL = "Tablet.qml";
|
||||||
static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml";
|
static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml";
|
||||||
static const char* LOADER_SOURCE_PROPERTY_NAME = "loaderSource";
|
static const char* LOADER_SOURCE_PROPERTY_NAME = "LoaderSource";
|
||||||
|
|
||||||
TabletProxy::TabletProxy(QString name) : _name(name) {
|
TabletProxy::TabletProxy(QString name) : _name(name) {
|
||||||
;
|
;
|
||||||
|
@ -79,6 +79,8 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr
|
||||||
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
if (_qmlTabletRoot && _qmlOffscreenSurface) {
|
||||||
QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
|
QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
|
||||||
gotoHomeScreen();
|
gotoHomeScreen();
|
||||||
|
//auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
||||||
|
//QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
||||||
} else {
|
} else {
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
}
|
}
|
||||||
|
@ -88,8 +90,10 @@ void TabletProxy::gotoHomeScreen() {
|
||||||
if (_qmlTabletRoot) {
|
if (_qmlTabletRoot) {
|
||||||
QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString();
|
QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString();
|
||||||
if (tabletSource != TABLET_SOURCE_URL) {
|
if (tabletSource != TABLET_SOURCE_URL) {
|
||||||
|
_qmlTabletRoot->setProperty(LOADER_SOURCE_PROPERTY_NAME, TABLET_SOURCE_URL);
|
||||||
|
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
||||||
|
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
|
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
|
||||||
addButtonsToHomeScreen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +103,7 @@ void TabletProxy::gotoWebScreen(const QString& url) {
|
||||||
removeButtonsFromHomeScreen();
|
removeButtonsFromHomeScreen();
|
||||||
QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString();
|
QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString();
|
||||||
if (tabletSource != WEB_VIEW_SOURCE_URL) {
|
if (tabletSource != WEB_VIEW_SOURCE_URL) {
|
||||||
|
_qmlTabletRoot->setProperty(LOADER_SOURCE_PROPERTY_NAME, WEB_VIEW_SOURCE_URL);
|
||||||
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
||||||
// TABLET_UI_HACK: TODO: addEventBridge to tablet....
|
// TABLET_UI_HACK: TODO: addEventBridge to tablet....
|
||||||
}
|
}
|
||||||
|
@ -168,6 +173,8 @@ void TabletProxy::addButtonsToHomeScreen() {
|
||||||
for (auto& buttonProxy : _tabletButtonProxies) {
|
for (auto& buttonProxy : _tabletButtonProxies) {
|
||||||
addButtonProxyToQmlTablet(tablet, buttonProxy.data());
|
addButtonProxyToQmlTablet(tablet, buttonProxy.data());
|
||||||
}
|
}
|
||||||
|
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
|
||||||
|
QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::removeButtonsFromHomeScreen() {
|
void TabletProxy::removeButtonsFromHomeScreen() {
|
||||||
|
|
|
@ -109,9 +109,11 @@ signals:
|
||||||
*/
|
*/
|
||||||
void webEventReceived(QVariant msg);
|
void webEventReceived(QVariant msg);
|
||||||
|
|
||||||
protected:
|
private slots:
|
||||||
|
|
||||||
void addButtonsToHomeScreen();
|
void addButtonsToHomeScreen();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
void removeButtonsFromHomeScreen();
|
void removeButtonsFromHomeScreen();
|
||||||
QQuickItem* getQmlTablet() const;
|
QQuickItem* getQmlTablet() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue