mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 15:23:05 +02:00
Merge pull request #11377 from vladest/create_resize
Add resizable flag. Use the flag for Create only
This commit is contained in:
commit
765031bf89
4 changed files with 49 additions and 4 deletions
|
@ -14,6 +14,8 @@ import "../../windows" as Windows
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
|
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
Windows.ScrollingWindow {
|
Windows.ScrollingWindow {
|
||||||
id: tabletRoot
|
id: tabletRoot
|
||||||
objectName: "tabletRoot"
|
objectName: "tabletRoot"
|
||||||
|
@ -25,8 +27,32 @@ Windows.ScrollingWindow {
|
||||||
shown: false
|
shown: false
|
||||||
resizable: false
|
resizable: false
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settings
|
||||||
|
category: "WindowRoot.Windows"
|
||||||
|
property real width: 480
|
||||||
|
property real height: 706
|
||||||
|
}
|
||||||
|
|
||||||
|
onResizableChanged: {
|
||||||
|
if (!resizable) {
|
||||||
|
// restore default size
|
||||||
|
settings.width = tabletRoot.width
|
||||||
|
settings.height = tabletRoot.height
|
||||||
|
tabletRoot.width = 480
|
||||||
|
tabletRoot.height = 706
|
||||||
|
} else {
|
||||||
|
tabletRoot.width = settings.width
|
||||||
|
tabletRoot.height = settings.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signal showDesktop();
|
signal showDesktop();
|
||||||
|
|
||||||
|
function setResizable(value) {
|
||||||
|
tabletRoot.resizable = value;
|
||||||
|
}
|
||||||
|
|
||||||
function setMenuProperties(rootMenu, subMenu) {
|
function setMenuProperties(rootMenu, subMenu) {
|
||||||
tabletRoot.rootMenu = rootMenu;
|
tabletRoot.rootMenu = rootMenu;
|
||||||
tabletRoot.subMenu = subMenu;
|
tabletRoot.subMenu = subMenu;
|
||||||
|
|
|
@ -425,6 +425,9 @@ void TabletProxy::gotoMenuScreen(const QString& submenu) {
|
||||||
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
emit screenChanged(QVariant("Menu"), QVariant(VRMENU_SOURCE_URL));
|
||||||
_currentPathLoaded = VRMENU_SOURCE_URL;
|
_currentPathLoaded = VRMENU_SOURCE_URL;
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,6 +447,9 @@ void TabletProxy::loadQMLOnTop(const QVariant& path) {
|
||||||
if (root) {
|
if (root) {
|
||||||
QMetaObject::invokeMethod(root, "loadQMLOnTop", Q_ARG(const QVariant&, path));
|
QMetaObject::invokeMethod(root, "loadQMLOnTop", Q_ARG(const QVariant&, path));
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(uiLogging) << "tablet cannot load QML because _qmlTabletRoot is null";
|
qCDebug(uiLogging) << "tablet cannot load QML because _qmlTabletRoot is null";
|
||||||
}
|
}
|
||||||
|
@ -470,9 +476,9 @@ void TabletProxy::returnToPreviousApp() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabletProxy::loadQMLSource(const QVariant& path) {
|
void TabletProxy::loadQMLSource(const QVariant& path, bool resizable) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "loadQMLSource", Q_ARG(QVariant, path));
|
QMetaObject::invokeMethod(this, "loadQMLSource", Q_ARG(QVariant, path), Q_ARG(bool, resizable));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,6 +498,10 @@ void TabletProxy::loadQMLSource(const QVariant& path) {
|
||||||
}
|
}
|
||||||
_currentPathLoaded = path;
|
_currentPathLoaded = path;
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(resizable)));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qCDebug(uiLogging) << "tablet cannot load QML because _qmlTabletRoot is null";
|
qCDebug(uiLogging) << "tablet cannot load QML because _qmlTabletRoot is null";
|
||||||
}
|
}
|
||||||
|
@ -523,6 +533,9 @@ bool TabletProxy::pushOntoStack(const QVariant& path) {
|
||||||
} else {
|
} else {
|
||||||
loadQMLSource(path);
|
loadQMLSource(path);
|
||||||
}
|
}
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(uiLogging) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
|
qCDebug(uiLogging) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null";
|
||||||
}
|
}
|
||||||
|
@ -599,6 +612,9 @@ void TabletProxy::loadWebScreenOnTop(const QVariant& url, const QString& injectJ
|
||||||
if (root) {
|
if (root) {
|
||||||
QMetaObject::invokeMethod(root, "loadQMLOnTop", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
QMetaObject::invokeMethod(root, "loadQMLOnTop", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL)));
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
QMetaObject::invokeMethod(root, "loadWebOnTop", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectJavaScriptUrl)));
|
QMetaObject::invokeMethod(root, "loadWebOnTop", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectJavaScriptUrl)));
|
||||||
}
|
}
|
||||||
_state = State::Web;
|
_state = State::Web;
|
||||||
|
@ -625,6 +641,9 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS
|
||||||
QMetaObject::invokeMethod(root, "loadWebBase");
|
QMetaObject::invokeMethod(root, "loadWebBase");
|
||||||
}
|
}
|
||||||
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true)));
|
||||||
|
if (_toolbarMode && _desktopWindow) {
|
||||||
|
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||||
|
}
|
||||||
QMetaObject::invokeMethod(root, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
QMetaObject::invokeMethod(root, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
||||||
}
|
}
|
||||||
_state = State::Web;
|
_state = State::Web;
|
||||||
|
|
|
@ -124,7 +124,7 @@ 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, bool loadOtherBase = false);
|
Q_INVOKABLE void gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase = false);
|
||||||
|
|
||||||
Q_INVOKABLE void loadQMLSource(const QVariant& path);
|
Q_INVOKABLE void loadQMLSource(const QVariant& path, bool resizable = false);
|
||||||
// FIXME: This currently relies on a script initializing the tablet (hence the bool denoting success);
|
// FIXME: This currently relies on a script initializing the tablet (hence the bool denoting success);
|
||||||
// it should be initialized internally so it cannot fail
|
// it should be initialized internally so it cannot fail
|
||||||
Q_INVOKABLE bool pushOntoStack(const QVariant& path);
|
Q_INVOKABLE bool pushOntoStack(const QVariant& path);
|
||||||
|
|
|
@ -655,7 +655,7 @@ var toolBar = (function () {
|
||||||
selectionDisplay.triggerMapping.disable();
|
selectionDisplay.triggerMapping.disable();
|
||||||
tablet.landscape = false;
|
tablet.landscape = false;
|
||||||
} else {
|
} else {
|
||||||
tablet.loadQMLSource("Edit.qml");
|
tablet.loadQMLSource("Edit.qml", true);
|
||||||
UserActivityLogger.enabledEdit();
|
UserActivityLogger.enabledEdit();
|
||||||
entityListTool.setVisible(true);
|
entityListTool.setVisible(true);
|
||||||
gridTool.setVisible(true);
|
gridTool.setVisible(true);
|
||||||
|
|
Loading…
Reference in a new issue