diff --git a/mix/qml/NewProjectDialog.qml b/mix/qml/NewProjectDialog.qml index 3c3c4e649..3ede9be90 100644 --- a/mix/qml/NewProjectDialog.qml +++ b/mix/qml/NewProjectDialog.qml @@ -5,96 +5,104 @@ import QtQuick.Dialogs 1.2 import QtQuick.Window 2.0 import QtQuick.Dialogs 1.1 -Dialog { - id: newProjectWin - modality: Qt.ApplicationModal - - width: 640 - height: 120 - - visible: false - - property alias projectTitle: titleField.text - readonly property string projectPath: "file://" + pathField.text - property alias pathFieldText: pathField.text +Item +{ signal accepted - function open() { newProjectWin.setX((Screen.width - width) / 2); newProjectWin.setY((Screen.height - height) / 2); - visible = true; + newProjectWin.visible = true; titleField.focus = true; } function close() { - visible = false; + newProjectWin.visible = false; } function acceptAndClose() { close(); accepted(); } - contentItem: Rectangle { - anchors.fill: parent - GridLayout - { - id: dialogContent - columns: 2 + + Dialog { + id: newProjectWin + modality: Qt.ApplicationModal + + width: 640 + height: 120 + + visible: false + + property alias projectTitle: titleField.text + readonly property string projectPath: "file://" + pathField.text + property alias pathFieldText: pathField.text + + + + contentItem: Rectangle { anchors.fill: parent - anchors.margins: 10 - rowSpacing: 10 - columnSpacing: 10 + GridLayout + { + id: dialogContent + columns: 2 + anchors.fill: parent + anchors.margins: 10 + rowSpacing: 10 + columnSpacing: 10 - Label { - text: qsTr("Title") - } - TextField { - id: titleField - focus: true - Layout.fillWidth: true - Keys.onReturnPressed: { - if (okButton.enabled) - acceptAndClose(); + Label { + text: qsTr("Title") } - } - - Label { - text: qsTr("Path") - } - RowLayout { TextField { - id: pathField + id: titleField + focus: true Layout.fillWidth: true Keys.onReturnPressed: { if (okButton.enabled) acceptAndClose(); } } - Button { - text: qsTr("Browse") - onClicked: createProjectFileDialog.open() - } - } - RowLayout - { - anchors.bottom: parent.bottom - anchors.right: parent.right; - - Button { - id: okButton; - enabled: titleField.text != "" && pathField.text != "" - text: qsTr("OK"); - onClicked: { - acceptAndClose(); + Label { + text: qsTr("Path") + } + RowLayout { + TextField { + id: pathField + Layout.fillWidth: true + Keys.onReturnPressed: { + if (okButton.enabled) + acceptAndClose(); + } + } + Button { + text: qsTr("Browse") + onClicked: createProjectFileDialog.open() } } - Button { - text: qsTr("Cancel"); - onClicked: close(); + + RowLayout + { + anchors.bottom: parent.bottom + anchors.right: parent.right; + + Button { + id: okButton; + enabled: titleField.text != "" && pathField.text != "" + text: qsTr("OK"); + onClicked: { + acceptAndClose(); + } + } + Button { + text: qsTr("Cancel"); + onClicked: close(); + } } } } + Component.onCompleted: pathField.text = fileIo.homePath + } FileDialog { @@ -111,5 +119,4 @@ Dialog { pathField.text = u; } } - Component.onCompleted: pathField.text = fileIo.homePath }