From ca16d37ce5fe70dd62cc24eafb5049a781bba73e Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 27 Apr 2015 12:46:34 -0700 Subject: [PATCH] Mac testing --- interface/resources/qml/VrMenu.qml | 42 +++++++++++++++++------------- libraries/ui/src/OffscreenUi.cpp | 2 +- tests/render-utils/src/main.cpp | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/interface/resources/qml/VrMenu.qml b/interface/resources/qml/VrMenu.qml index 01714e9ebe..4bbcb9c498 100644 --- a/interface/resources/qml/VrMenu.qml +++ b/interface/resources/qml/VrMenu.qml @@ -108,7 +108,7 @@ Hifi.VrMenu { height: 32 color: hifi.colors.hifiBlue y: (listView.currentItem) ? listView.currentItem.y : 0; - x: 32 + x: (listView.currentItem) ? listView.currentItem.height : 0; Behavior on y { NumberAnimation { duration: 100 @@ -132,6 +132,12 @@ Hifi.VrMenu { property: "source" value: modelData when: loader.status == Loader.Ready + } + Binding { + target: loader.item + property: "border" + value: listView.parent + when: loader.status == Loader.Ready } Binding { target: loader.item @@ -147,10 +153,11 @@ Hifi.VrMenu { property var itemBuilder: Component { Text { id: thisText - x: 32 + x: height property var source property var root property var listView + property var border text: typedText() height: implicitHeight width: implicitWidth @@ -167,12 +174,6 @@ Hifi.VrMenu { } } - onVisibleChanged: { - if (listView) { - listView.recalculateSize(); - } - } - onImplicitWidthChanged: { if (listView) { listView.minWidth = Math.max(listView.minWidth, implicitWidth + 64); @@ -182,12 +183,13 @@ Hifi.VrMenu { FontAwesome { visible: source.type == 1 && source.checkable - x: -32 + x: -parent.height + size: parent.height text: checkText(); color: parent.color function checkText() { - if (source.type != 1) { - return; + if (!source || source.type != 1) { + return ""; } // FIXME this works for native QML menus but I don't think it will // for proxied QML menus @@ -199,6 +201,7 @@ Hifi.VrMenu { } FontAwesome { + size: parent.height visible: source.type == 2 x: listView.width - 32 - (hifi.layout.spacing * 2) text: "\uF0DA" @@ -206,14 +209,17 @@ Hifi.VrMenu { } function typedText() { - switch(source.type) { - case 2: - return source.title; - case 1: - return source.text; - case 0: - return "-----" + if (source) { + switch(source.type) { + case 2: + return source.title; + case 1: + return source.text; + case 0: + return "-----" + } } + return "" } MouseArea { diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 5db7349a02..8ba7b514e4 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -124,9 +124,9 @@ void OffscreenUi::resize(const QSize& newSize) { if (_quickWindow) { _quickWindow->setGeometry(QRect(QPoint(), newSize)); + _quickWindow->contentItem()->setSize(newSize); } - _quickWindow->contentItem()->setSize(newSize); // Update our members if (_rootItem) { diff --git a/tests/render-utils/src/main.cpp b/tests/render-utils/src/main.cpp index 5e45bf23a2..0ba7416b28 100644 --- a/tests/render-utils/src/main.cpp +++ b/tests/render-utils/src/main.cpp @@ -205,7 +205,7 @@ void QTestWindow::renderText() { { size.x + QUAD_OFFSET.x, QUAD_OFFSET.y }, { size.x + QUAD_OFFSET.x, size.y + QUAD_OFFSET.y }, { QUAD_OFFSET.x, size.y + QUAD_OFFSET.y }, - }; + }; QString str = QString::fromWCharArray(EXAMPLE_TEXT); for (int i = 0; i < 4; ++i) {