Merge pull request #11442 from vladest/fix_dde_visibility

Fix dde visibility
This commit is contained in:
Andrew Meadows 2017-09-26 14:19:47 -07:00 committed by GitHub
commit 909e5e86b1
3 changed files with 22 additions and 21 deletions

View file

@ -21,9 +21,9 @@ Item {
property alias text: label.text
property var source
implicitHeight: source.visible ? 2 * label.implicitHeight : 0
implicitHeight: source !== null ? source.visible ? 2 * label.implicitHeight : 0 : 0
implicitWidth: 2 * hifi.dimensions.menuPadding.x + check.width + label.width + tail.width
visible: source.visible
visible: source !== null ? source.visible : false
width: parent.width
Item {
@ -42,7 +42,9 @@ Item {
id: checkbox
// FIXME: Should use radio buttons if source.exclusiveGroup.
width: 20
visible: source.visible && source.type === 1 && source.checkable && !source.exclusiveGroup
visible: source !== null ?
source.visible && source.type === 1 && source.checkable && !source.exclusiveGroup :
false
checked: setChecked()
function setChecked() {
if (!source || source.type !== 1 || !source.checkable) {
@ -58,7 +60,9 @@ Item {
id: radiobutton
// FIXME: Should use radio buttons if source.exclusiveGroup.
width: 20
visible: source.visible && source.type === 1 && source.checkable && source.exclusiveGroup
visible: source !== null ?
source.visible && source.type === 1 && source.checkable && source.exclusiveGroup :
false
checked: setChecked()
function setChecked() {
if (!source || source.type !== 1 || !source.checkable) {
@ -80,9 +84,13 @@ Item {
anchors.left: check.right
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
color: source.enabled ? hifi.colors.baseGrayShadow : hifi.colors.baseGrayShadow50
enabled: source.visible && (source.type !== 0 ? source.enabled : false)
visible: source.visible
color: source !== null ?
source.enabled ? hifi.colors.baseGrayShadow :
hifi.colors.baseGrayShadow50 :
"transparent"
enabled: source !== null ? source.visible && (source.type !== 0 ? source.enabled : false) : false
visible: source !== null ? source.visible : false
wrapMode: Text.WordWrap
}
@ -93,7 +101,7 @@ Item {
leftMargin: hifi.dimensions.menuPadding.x + check.width
rightMargin: hifi.dimensions.menuPadding.x + tail.width
}
visible: source.type === MenuItemType.Separator
visible: source !== null ? source.type === MenuItemType.Separator : false
Rectangle {
anchors {
@ -117,23 +125,23 @@ Item {
RalewayLight {
id: shortcut
text: source.shortcut ? source.shortcut : ""
text: source !== null ? source.shortcut ? source.shortcut : "" : ""
size: hifi.fontSizes.shortcutText
color: hifi.colors.baseGrayShadow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 15
visible: source.visible && text != ""
visible: source !== null ? source.visible && text != "" : false
}
HiFiGlyphs {
text: hifi.glyphs.disclosureExpand
color: source.enabled ? hifi.colors.baseGrayShadow : hifi.colors.baseGrayShadow25
color: source !== null ? source.enabled ? hifi.colors.baseGrayShadow : hifi.colors.baseGrayShadow25 : "transparent"
size: 70
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
horizontalAlignment: Text.AlignRight
visible: source.visible && (source.type === 2)
visible: source !== null ? source.visible && (source.type === 2) : false
}
}
}

View file

@ -70,7 +70,6 @@ Item {
for (var i = 0; i < items.length; ++i) {
var item = items[i];
if (!item.visible) continue;
switch (item.type) {
case MenuItemType.Menu:
result.append({"name": item.title, "item": item})
@ -216,5 +215,4 @@ Item {
function nextItem() { d.topMenu.nextItem(); }
function selectCurrentItem() { d.topMenu.selectCurrentItem(); }
function previousPage() { d.topMenu.previousPage(); }
}

View file

@ -9,8 +9,6 @@
//
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../styles-uit"
import "."
@ -36,7 +34,6 @@ FocusScope {
//color: isSubMenu ? hifi.colors.faintGray : hifi.colors.faintGray80
}
ListView {
id: listView
x: 0
@ -68,8 +65,8 @@ FocusScope {
delegate: TabletMenuItem {
text: name
source: item
onImplicitHeightChanged: listView.recalcSize()
onImplicitWidthChanged: listView.recalcSize()
onImplicitHeightChanged: listView !== null ? listView.recalcSize() : 0
onImplicitWidthChanged: listView !== null ? listView.recalcSize() : 0
MouseArea {
anchors.fill: parent
@ -124,8 +121,6 @@ FocusScope {
function nextItem() { listView.currentIndex = (listView.currentIndex + listView.count + 1) % listView.count; }
function selectCurrentItem() { if (listView.currentIndex != -1) root.selected(currentItem.source); }
function previousPage() { root.parent.pop(); }
}