diff --git a/interface/resources/qml/controls-uit/TabletComboBox.qml b/interface/resources/qml/controls-uit/TabletComboBox.qml index e5dec315e5..7361833a45 100644 --- a/interface/resources/qml/controls-uit/TabletComboBox.qml +++ b/interface/resources/qml/controls-uit/TabletComboBox.qml @@ -14,7 +14,6 @@ import QtQuick.Controls.Styles 1.4 import "../styles-uit" import "../controls-uit" as HifiControls -import "." as VrControls FocusScope { id: root @@ -119,14 +118,14 @@ FocusScope { } function showList() { - var r = 20//desktop.mapFromItem(root, 0, 0, root.width, root.height); - var y = 200; - var bottom = 0 + scrollView.height; + var r = mapFromItem(root, 0, 0, root.width, root.height); + var y = r.y + r.height; + var bottom = y + scrollView.height; if (bottom > 720) { - y -= bottom - 720 + 8; + y -= bottom - tabletRoot.height + 8; } - scrollView.x = 0; - scrollView.y = 0; + scrollView.x = r.x; + scrollView.y = y; popup.visible = true; popup.forceActiveFocus(); listView.currentIndex = root.currentIndex; @@ -141,6 +140,7 @@ FocusScope { FocusScope { id: popup + z: 12 parent: parent anchors.fill: parent visible: false diff --git a/interface/resources/qml/hifi/tablet/NewModelDialog.qml b/interface/resources/qml/hifi/tablet/NewModelDialog.qml index 13c0d963ea..d57ffdc72f 100644 --- a/interface/resources/qml/hifi/tablet/NewModelDialog.qml +++ b/interface/resources/qml/hifi/tablet/NewModelDialog.qml @@ -11,12 +11,15 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 +import "../../styles-uit" +import "../../controls-uit" Rectangle { id: newModelDialog // width: parent.width // height: parent.height - + HifiConstants { id: hifi } + color: hifi.colors.baseGray; property var eventBridge; signal sendToScript(var message); @@ -32,6 +35,7 @@ Rectangle { Text { id: text1 text: qsTr("Model URL") + color: "#ffffff" font.pixelSize: 12 } @@ -64,6 +68,7 @@ Rectangle { CheckBox { id: dynamic text: qsTr("Dynamic") + } Row { @@ -82,6 +87,7 @@ Rectangle { Text { id: text2 width: 160 + color: "#ffffff" text: qsTr("Models with automatic collisions set to 'Exact' cannot be dynamic") wrapMode: Text.WordWrap font.pixelSize: 12 @@ -97,30 +103,34 @@ Rectangle { Text { id: text3 text: qsTr("Automatic Collisions") + color: "#ffffff" font.pixelSize: 12 } - ComboBox { + TabletComboBox { id: collisionType width: 200 + z: 100 transformOrigin: Item.Center - model: ListModel { - id: collisionDropdown - ListElement { text: "No Collision" } - ListElement { text: "Basic - Whole model" } - ListElement { text: "Good - Sub-meshes" } - ListElement { text: "Exact - All polygons" } - } + model: ["No Collision", + "Basic - Whole model", + "Good - Sub-meshes", + "Exact - All polygons"] } Row { id: row3 width: 200 height: 400 - + spacing: 5 + + anchors { + rightMargin: 15 + } Button { id: button1 text: qsTr("Add") + z: -1 onClicked: { newModelDialog.sendToScript({ method: "newModelDialogAdd", @@ -135,6 +145,7 @@ Rectangle { Button { id: button2 + z: -1 text: qsTr("Cancel") onClicked: { newModelDialog.sendToScript({method: "newModelDialogCancel"}) diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index 04e170a8d7..61851e33b0 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -344,8 +344,15 @@ void TabletProxy::pushOntoStack(const QVariant& path) { } else { qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack"; } + } else if (_desktopWindow) { + auto stack = _desktopWindow->asQuickItem()->findChild("stack"); + if (stack) { + QMetaObject::invokeMethod(stack, "pushSource", Q_ARG(const QVariant&, path)); + } else { + qCDebug(scriptengine) << "tablet cannot push QML because _desktopWindow doesn't have child stack"; + } } else { - qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot is null"; + qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot or _desktopWindow is null"; } } @@ -355,10 +362,17 @@ void TabletProxy::popFromStack() { if (stack) { QMetaObject::invokeMethod(stack, "popSource"); } else { - qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot doesn't have child stack"; + qCDebug(scriptengine) << "tablet cannot push QML because _qmlTabletRoot doesn't have child stack"; + } + } else if (_desktopWindow) { + auto stack = _desktopWindow->asQuickItem()->findChild("stack"); + if (stack) { + QMetaObject::invokeMethod(stack, "popSource"); + } else { + qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack"; } } else { - qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot is null"; + qCDebug(scriptengine) << "tablet cannot pop QML because _qmlTabletRoot or _desktopWindow is null"; } }