Skip to content
Snippets Groups Projects
Dialog.qml 2.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • import QtQuick 2.0
    import QtQuick.Layouts 1.0
    import QtQuick.Controls 1.0
    
    
    akiraohgaki's avatar
    akiraohgaki committed
    ColumnLayout {
    
        id: dialog
    
    
    akiraohgaki's avatar
    akiraohgaki committed
        visible: false
    
        anchors.fill: parent
        anchors.margins: 12
    
    akiraohgaki's avatar
    akiraohgaki committed
        spacing: 12
    
    
        property alias icon: icon.source
        property alias primaryText: primaryText.text
        property alias informativeText: informativeText.text
    
    akiraohgaki's avatar
    akiraohgaki committed
        property alias detailedText: detailedText.text
    
        property alias content: content.children
        property alias acceptButton: acceptButton
        property alias rejectButton: rejectButton
    
        function open() {
            dialog.visible = true;
        }
    
        function close() {
            dialog.visible = false;
        }
    
    
    akiraohgaki's avatar
    akiraohgaki committed
        RowLayout {
            Layout.fillWidth: true
            spacing: 12
            Image {
                id: icon
                source: ""
                visible: source.toString() ? true : false
    
    akiraohgaki's avatar
    akiraohgaki committed
                Layout.preferredWidth: 48
                Layout.preferredHeight: 48
    
    akiraohgaki's avatar
    akiraohgaki committed
                sourceSize.width: 128
                sourceSize.height: 128
    
    akiraohgaki's avatar
    akiraohgaki committed
            }
            ColumnLayout {
                Layout.fillWidth: true
                spacing: 4
                Label {
                    id: primaryText
                    text: ""
                    visible: text ? true : false
                    Layout.fillWidth: true
                    wrapMode: Text.WrapAnywhere
                    font.bold: true
                }
                Label {
                    id: informativeText
                    text: ""
                    visible: text ? true : false
                    Layout.fillWidth: true
                    wrapMode: Text.WrapAnywhere
                }
            }
    
    akiraohgaki's avatar
    akiraohgaki committed
        }
    
    
    akiraohgaki's avatar
    akiraohgaki committed
        Label {
            id: detailedText
            text: ""
            visible: text ? true : false
    
            Layout.fillWidth: true
    
    akiraohgaki's avatar
    akiraohgaki committed
            wrapMode: Text.WrapAnywhere
            color: "#444444"
        }
    
        Item {
            id: content
            Layout.fillWidth: true
        }
    
        Item {
            Layout.fillHeight: true
        }
    
        RowLayout {
            Layout.fillWidth: true
            spacing: 4
            Item {
    
    akiraohgaki's avatar
    akiraohgaki committed
                Layout.fillWidth: true
    
    akiraohgaki's avatar
    akiraohgaki committed
            Button {
                id: acceptButton
    
    akiraohgaki's avatar
    akiraohgaki committed
                text: ""
                visible: text ? true : false
            }
    
    akiraohgaki's avatar
    akiraohgaki committed
            Button {
                id: rejectButton
    
    akiraohgaki's avatar
    akiraohgaki committed
                text: ""
                visible: text ? true : false