Merge pull request #6922 from jherico/qml

More QML bug fixes
This commit is contained in:
Brad Hefta-Gaub 2016-01-25 09:58:34 -08:00
commit 78911ae9ca
9 changed files with 65 additions and 83 deletions

View file

@ -19,7 +19,9 @@ Window {
HifiConstants { id: hifi }
anchors.centerIn: parent
objectName: "AddressBarDialog"
frame: HiddenFrame {}
visible: false
destroyOnInvisible: false
resizable: false
scale: 1.25 // Make this dialog a little larger than normal
@ -34,7 +36,6 @@ Window {
Image {
id: backgroundImage
source: "../images/address-bar.svg"
width: 576 * root.scale
height: 80 * root.scale
@ -55,12 +56,12 @@ Window {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
onClicked: {
addressBarDialog.loadBack()
}
}
}
Image {
id: forwardArrow
source: addressBarDialog.forwardEnabled ? "../images/right-arrow.svg" : "../images/right-arrow-disabled.svg"
@ -84,7 +85,7 @@ Window {
// FIXME replace with TextField
TextInput {
id: addressLine
focus: true
anchors {
fill: parent
leftMargin: parent.height + parent.height + hifi.layout.spacing * 5
@ -106,19 +107,19 @@ Window {
addressLine.text = ""
}
}
function toggleOrGo() {
if (addressLine.text != "") {
if (addressLine.text !== "") {
addressBarDialog.loadAddress(addressLine.text)
}
root.close();
root.visible = false;
}
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
root.close()
root.visible = false
event.accepted = true
break
case Qt.Key_Enter:

View file

@ -70,6 +70,7 @@ Window {
source: "../images/login-username.svg"
width: loginDialog.inputHeight * 0.65
height: width
sourceSize: Qt.size(width, height);
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
@ -103,6 +104,7 @@ Window {
source: "../images/login-password.svg"
width: loginDialog.inputHeight * 0.65
height: width
sourceSize: Qt.size(width, height);
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
@ -215,67 +217,53 @@ Window {
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
cursorShape: Qt.PointingHandCursor
onClicked: {
loginDialog.login(username.text, password.text)
}
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Item {
anchors { left: parent.left; right: parent.right; }
height: loginDialog.inputHeight
Image {
id: hifiIcon
source: "../images/hifi-logo-blackish.svg"
width: loginDialog.inputHeight
height: width
sourceSize: Qt.size(width, height);
anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter }
}
Text {
anchors { verticalCenter: parent.verticalCenter; right: hifiIcon.left; margins: loginDialog.inputSpacing }
text: "Password?"
font.pixelSize: hifi.fonts.pixelSize * 0.8
scale: 0.8
font.underline: true
color: "#e0e0e0"
width: loginDialog.inputHeight * 4
horizontalAlignment: Text.AlignRight
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
onClicked: {
loginDialog.openUrl(loginDialog.rootUrl + "/users/password/new")
}
}
}
Item {
width: loginDialog.inputHeight + loginDialog.inputSpacing * 2
height: loginDialog.inputHeight
Image {
id: hifiIcon
source: "../images/hifi-logo-blackish.svg"
width: loginDialog.inputHeight
height: width
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
anchors { fill: parent; margins: -loginDialog.inputSpacing / 2 }
cursorShape: Qt.PointingHandCursor
onClicked: loginDialog.openUrl(loginDialog.rootUrl + "/users/password/new")
}
}
Text {
anchors { verticalCenter: parent.verticalCenter; left: hifiIcon.right; margins: loginDialog.inputSpacing }
text: "Register"
font.pixelSize: hifi.fonts.pixelSize * 0.8
scale: 0.8
font.underline: true
color: "#e0e0e0"
width: loginDialog.inputHeight * 4
horizontalAlignment: Text.AlignLeft
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
cursorShape: "PointingHandCursor"
onClicked: {
loginDialog.openUrl(loginDialog.rootUrl + "/signup")
}
anchors { fill: parent; margins: -loginDialog.inputSpacing / 2 }
cursorShape: Qt.PointingHandCursor
onClicked: loginDialog.openUrl(loginDialog.rootUrl + "/signup")
}
}
}
}
}
@ -294,7 +282,7 @@ Window {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
root.close();
root.visible = false;
event.accepted = true;
break;

View file

@ -13,7 +13,7 @@ Windows.Window {
objectName: "ToolWindow"
destroyOnCloseButton: false
destroyOnInvisible: false
closable: false
closable: true
visible: false
width: 384; height: 640;
property string newTabSource
@ -54,17 +54,12 @@ Windows.Window {
}
function updateVisiblity() {
var newVisible = false
console.log("Checking " + tabView.count + " children")
for (var i = 0; i < tabView.count; ++i) {
if (tabView.getTab(i).enabled) {
console.log("Tab " + i + " enabled");
newVisible = true;
break;
return;
}
}
console.log("Setting toolWindow visible: " + newVisible);
visible = newVisible
visible = false;
}
function findIndexForUrl(source) {
@ -127,7 +122,6 @@ Windows.Window {
var title = properties.title || "Unknown";
newTabSource = properties.source;
console.log(typeof(properties.source))
var newTab = tabView.addTab(title, webTabCreator);
newTab.active = true;
newTab.enabled = false;

View file

@ -146,7 +146,7 @@ ModalWindow {
currentRow = -1;
} else {
root.selectedFile(file);
root.close();
root.visible = false;
}
}
}
@ -182,14 +182,14 @@ ModalWindow {
KeyNavigation.left: openButton
KeyNavigation.right: fileTableView.contentItem
Keys.onReturnPressed: { canceled(); root.enabled = false }
onClicked: { canceled(); close() }
onClicked: { canceled(); root.visible = false; }
}
Button {
id: openButton
text: root.selectDirectory ? "Choose" : "Open"
enabled: currentSelection.text ? true : false
onClicked: { selectedFile(d.currentSelectionUrl); close(); }
Keys.onReturnPressed: { selectedFile(d.currentSelectionUrl); close(); }
onClicked: { selectedFile(d.currentSelectionUrl); root.visible = false; }
Keys.onReturnPressed: { selectedFile(d.currentSelectionUrl); root.visible = false; }
KeyNavigation.up: selectionType
KeyNavigation.left: selectionType

View file

@ -50,7 +50,7 @@ Frame {
id: closeClickArea
anchors.fill: parent
hoverEnabled: true
onClicked: frame.close();
onClicked: window.visible = false;
}
}
}

View file

@ -9,9 +9,6 @@ FocusScope {
id: root
HifiConstants { id: hifi }
// Should hiding the window destroy it or just hide it?
property bool destroyOnInvisible: false
Component.onCompleted: {
fadeTargetProperty = visible ? 1.0 : 0.0
}
@ -36,10 +33,6 @@ FocusScope {
fadeTargetProperty = target ? 1.0 : 0.0;
return;
}
if (!visible && destroyOnInvisible) {
destroy();
}
}
// The actual animator

View file

@ -28,14 +28,6 @@ Item {
y: -height
}
function close() {
window.close();
}
function raise() {
window.raise();
}
function deltaSize(dx, dy) {
var newSize = Qt.vector2d(window.width + dx, window.height + dy);
newSize = Utils.clampVector(newSize, window.minSize, window.maxSize);

View file

@ -0,0 +1,10 @@
import QtQuick 2.5
import "."
Frame {
id: frame
Item { anchors.fill: parent }
}

View file

@ -33,6 +33,8 @@ Fadable {
property bool alwaysOnTop: false
// Should hitting the close button hide or destroy the window?
property bool destroyOnCloseButton: true
// Should hiding the window destroy it or just hide it?
property bool destroyOnInvisible: false
// FIXME support for pinned / unpinned pending full design
// property bool pinnable: false
// property bool pinned: false
@ -117,13 +119,15 @@ Fadable {
// don't do anything but manipulate the targetVisible flag and let the other
// mechanisms decide if the window should be destroyed after the close
// animation completes
function close() {
console.log("Closing " + window)
if (destroyOnCloseButton) {
destroyOnInvisible = true
}
visible = false;
}
// FIXME using this close function messes up the visibility signals received by the
// type and it's derived types
// function close() {
// console.log("Closing " + window)
// if (destroyOnCloseButton) {
// destroyOnInvisible = true
// }
// visible = false;
// }
function framedRect() {
if (!frame || !frame.decoration) {