MessageBox.qml 1.5 KB
Newer Older
Artem Sidyakin's avatar
Artem Sidyakin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11

Window {
    id: dialog

    // both title and message text properties are available to be set from "outside"
    property string title
    property string textMain

    title: dialog.title
    modality: Qt.WindowModal

    width: 400
    minimumWidth: width
    maximumWidth: width
    height: 200
    minimumHeight: height
    maximumHeight: height

    Rectangle {
        anchors.fill: parent
        //color: Styles.regionBackground
        //border.color: Styles.mainBackground
        //border.width: 3

        ColumnLayout {
            anchors.fill: parent
            spacing: 0

            ScrollView {
                Layout.fillWidth: true
                Layout.fillHeight: true
//                Layout.topMargin: 10
//                Layout.leftMargin: 15
//                Layout.rightMargin: 15

                TextArea {
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    text: dialog.textMain
                    font.family: "Courier New"
                    font.pixelSize: 16
                    wrapMode: Text.WordWrap
                }
            }

            Button {
                id: btn
//                Layout.leftMargin: 3
//                Layout.rightMargin: 3
                Layout.fillWidth: true
                text: "Close"
                onClicked: { dialog.close(); }
            }
        }
    }
}