This commit is contained in:
Brad Davis 2016-01-03 20:29:31 -08:00
parent 435ab8c4e8
commit 297e58fbc6
3 changed files with 8 additions and 18 deletions

View file

@ -24,17 +24,11 @@ Hifi.VrMenu {
property var columns: [] property var columns: []
onEnabledChanged: { onEnabledChanged: {
console.log("Activating menu " + enabled);
if (enabled && columns.length == 0) { if (enabled && columns.length == 0) {
console.log(rootMenu)
console.log(rootMenu.items)
pushColumn(rootMenu.items); pushColumn(rootMenu.items);
} }
opacity = enabled ? 1.0 : 0.0 opacity = enabled ? 1.0 : 0.0
offscreenFlags.navigationFocused = enabled; offscreenFlags.navigationFocused = enabled;
// if (enabled) {
//forceActiveFocus()
// }
} }
// The actual animator // The actual animator
@ -67,7 +61,6 @@ Hifi.VrMenu {
x = lastColumn.x + 64; x = lastColumn.x + 64;
y = lastMousePosition.y - height / 2; y = lastMousePosition.y - height / 2;
} }
//recalcSize();
} }
onSelected: { onSelected: {
@ -112,8 +105,6 @@ Hifi.VrMenu {
function itemsToModel(items) { function itemsToModel(items) {
var newListModel = Qt.createQmlObject('import QtQuick 2.2; ListModel {}', root); var newListModel = Qt.createQmlObject('import QtQuick 2.2; ListModel {}', root);
console.log(items)
console.log(items.length)
for (var i = 0; i < items.length; ++i) { for (var i = 0; i < items.length; ++i) {
var item = items[i]; var item = items[i];
switch (item.type) { switch (item.type) {

View file

@ -1,19 +1,19 @@
import QtQuick 2.4 import QtQuick 2.4
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import "styles"
import "controls" import "controls"
import "styles"
Item { Item {
id: root id: root
HifiConstants { id: hifi } HifiConstants {
id: hifi
}
// The model object // The model object
property alias text: label.text property alias text: label.text
property var source property var source
implicitHeight: source.visible ? label.implicitHeight * 1.5 : 0 implicitHeight: source.visible ? label.implicitHeight * 1.5 : 0
implicitWidth: label.width + label.height * 2.5 implicitWidth: label.width + label.height * 2.5
visible: source.visible visible: source.visible

View file

@ -9,15 +9,16 @@ ListView {
HifiConstants { id: hifi } HifiConstants { id: hifi }
width: 128 width: 128
height: count * 32 height: count * 32
onEnabledChanged: root.recalcSize(); onEnabledChanged: recalcSize();
onVisibleChanged: root.recalcSize(); onVisibleChanged: recalcSize();
onCountChanged: recalcSize();
signal selected(var item) signal selected(var item)
highlight: Rectangle { highlight: Rectangle {
width: root.currentItem ? root.currentItem.width : 0 width: root.currentItem ? root.currentItem.width : 0
height: root.currentItem ? root.currentItem.height : 0 height: root.currentItem ? root.currentItem.height : 0
color: "lightsteelblue"; radius: 3 color: "lightsteelblue"; radius: 3
// y: root.currentItem ? root.currentItem.y : 0
} }
delegate: VrMenuItem { delegate: VrMenuItem {
@ -34,8 +35,6 @@ ListView {
} }
} }
onCountChanged: recalcSize();
function recalcSize() { function recalcSize() {
if (model.count !== count || !visible) { if (model.count !== count || !visible) {
return; return;