From 2269447741c405d150a38340afaab51bd6040df5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Dec 2018 14:52:36 -0800 Subject: [PATCH] Fix AvatarPackager QML size --- .../resources/qml/hifi/AvatarPackager.qml | 8 ++-- .../qml/hifi/avatarPackager/AvatarProject.qml | 43 +++++++++---------- interface/src/avatar/AvatarProject.cpp | 5 ++- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/interface/resources/qml/hifi/AvatarPackager.qml b/interface/resources/qml/hifi/AvatarPackager.qml index 434cd4128f..5a51a3c873 100644 --- a/interface/resources/qml/hifi/AvatarPackager.qml +++ b/interface/resources/qml/hifi/AvatarPackager.qml @@ -21,9 +21,11 @@ Windows.ScrollingWindow { implicitWidth: 384; implicitHeight: 640 minSize: Qt.vector2d(200, 300) + //HifiConstants { id: hifi } - Rectangle { - anchors.fill: parent + Item { + height: pane.height + width: pane.width AvatarProject { id: avatarProject @@ -32,7 +34,7 @@ Windows.ScrollingWindow { anchors.fill: parent } - Rectangle { + Item { id: avatarPackagerMain anchors.left: parent.left anchors.right: parent.right diff --git a/interface/resources/qml/hifi/avatarPackager/AvatarProject.qml b/interface/resources/qml/hifi/avatarPackager/AvatarProject.qml index c365d7436e..085f1acdce 100644 --- a/interface/resources/qml/hifi/avatarPackager/AvatarProject.qml +++ b/interface/resources/qml/hifi/avatarPackager/AvatarProject.qml @@ -6,18 +6,17 @@ import QtGraphicalEffects 1.0 import "../../controlsUit" 1.0 as HifiControls import "../../stylesUit" 1.0 -Rectangle { +Item { id: root HifiConstants { id: hifi } property int colorScheme; - color: "blue" - visible: true anchors.fill: parent + anchors.margins: 10 RalewaySemiBold { id: avatarProjectLabel @@ -26,11 +25,13 @@ Rectangle { anchors.topMargin: 25 anchors.bottomMargin: 25 text: 'Avatar Project' + color: "white" } HifiControls.Button { id: openFolderButton width: parent.width anchors.top: avatarProjectLabel.bottom + anchors.topMargin: 10 text: qsTr("Open Project Folder") colorScheme: root.colorScheme height: 30 @@ -38,28 +39,15 @@ Rectangle { fileDialogHelper.openDirectory(AvatarPackagerCore.currentAvatarProject.projectFolderPath); } } - HifiControls.Button { - id: uploadButton - width: parent.width - anchors.top: openFolderButton.bottom - text: qsTr("Upload") - color: hifi.buttons.blue - colorScheme: root.colorScheme - height: 30 - onClicked: function() { - } - } - Text { - id: modelText - anchors.top: uploadButton.bottom - height: 30 - text: parent.height - } Rectangle { color: 'white' visible: AvatarPackagerCore.currentAvatarProject !== null - width: parent.width - anchors.top: modelText.bottom + anchors.top: openFolderButton.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: uploadButton.top + anchors.topMargin: 10 + anchors.bottomMargin: 10 height: 1000 ListView { @@ -68,4 +56,15 @@ Rectangle { delegate: Text { text: 'File: ' + modelData } } } + HifiControls.Button { + id: uploadButton + width: parent.width + anchors.bottom: parent.bottom + text: qsTr("Upload") + color: hifi.buttons.blue + colorScheme: root.colorScheme + height: 30 + onClicked: function() { + } + } } diff --git a/interface/src/avatar/AvatarProject.cpp b/interface/src/avatar/AvatarProject.cpp index 32fe4febcd..c7ea7e52ac 100644 --- a/interface/src/avatar/AvatarProject.cpp +++ b/interface/src/avatar/AvatarProject.cpp @@ -17,6 +17,7 @@ #include #include #include +#include AvatarProject* AvatarProject::openAvatarProject(const QString& path) { const auto pathToLower = path.toLower(); @@ -25,7 +26,9 @@ AvatarProject* AvatarProject::openAvatarProject(const QString& path) { if (!file.open(QIODevice::ReadOnly)) { return nullptr; } - return new AvatarProject(path, file.readAll()); + auto project = new AvatarProject(path, file.readAll()); + QQmlEngine::setObjectOwnership(project, QQmlEngine::CppOwnership); + return project; } if (pathToLower.endsWith(".fbx")) {