From d53d7a380e910175cda9ab341fe5a14ca4c72853 Mon Sep 17 00:00:00 2001 From: Akira Ohgaki <akiraohgaki@gmail.com> Date: Wed, 1 Mar 2017 12:39:07 +0900 Subject: [PATCH] Add Custom Dialog component --- app/qml/qml.qrc | 1 + app/qml/ui/Dialog.qml | 78 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 app/qml/ui/Dialog.qml diff --git a/app/qml/qml.qrc b/app/qml/qml.qrc index 640e9f0..f0579e6 100644 --- a/app/qml/qml.qrc +++ b/app/qml/qml.qrc @@ -1,6 +1,7 @@ <RCC> <qresource prefix="/qml"> <file>main.qml</file> + <file>ui/Dialog.qml</file> <file>scripts/Utility.js</file> </qresource> </RCC> diff --git a/app/qml/ui/Dialog.qml b/app/qml/ui/Dialog.qml new file mode 100644 index 0000000..ec632bc --- /dev/null +++ b/app/qml/ui/Dialog.qml @@ -0,0 +1,78 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 1.0 + +ColumnLayout { + id: dialog + + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + visible: false + + property alias icon: icon.source + property alias primaryText: primaryText.text + property alias informativeText: informativeText.text + property alias content: content.children + property alias acceptButton: acceptButton + property alias rejectButton: rejectButton + + function open() { + dialog.visible = true; + } + + function close() { + dialog.visible = false; + } + + RowLayout { + Layout.fillWidth: true + Layout.fillHeight: true + spacing: parent.spacing + Image { + id: icon + source: "" + width: 32 + height: width + visible: source ? true : false + } + ColumnLayout { + Layout.fillWidth: true + spacing: parent.spacing + Label { + id: primaryText + text: "" + font.bold: true + visible: text ? true : false + } + Label { + id: informativeText + text: "" + visible: text ? true : false + } + Item { + id: content + Layout.fillWidth: true + Layout.fillHeight: true + } + } + } + + RowLayout { + Layout.fillWidth: true + spacing: parent.spacing + Item { + Layout.fillWidth: true + } + Button { + id: acceptButton + text: "" + visible: text ? true : false + } + Button { + id: rejectButton + text: "" + visible: text ? true : false + } + } +} -- GitLab