This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/resources/prompt.qml

73 lines
1.5 KiB
QML
Raw Permalink Normal View History

2021-04-22 14:48:16 +08:00
import QtQuick 2.12
import QtQuick.Controls 2.12
2021-06-16 13:51:45 +08:00
import QtQuick.Layouts 1.14
2021-04-22 14:48:16 +08:00
2021-04-26 21:21:59 +08:00
ApplicationWindow {
2021-04-22 14:48:16 +08:00
id: window
2021-06-10 19:19:26 +08:00
flags: Qt.WindowStaysOnTopHint | Qt.Tool | Qt.FramelessWindowHint
2021-04-22 14:48:16 +08:00
visible: true
modality: Qt.ApplicationModal
property var pointer
property var plugin
property var callbackId
property var title
property var msg
property var okLabel
property var cancelLabel
onTitleChanged: {
dialog.title = title
}
onMsgChanged: {
content.text = msg
}
onOkLabelChanged: {
dialog.standardButton(Dialog.Ok).text = qsTrId(okLabel)
}
onCancelLabelChanged: {
dialog.standardButton(Dialog.Cancel).text = qsTrId(cancelLabel)
}
Dialog {
id: dialog
standardButtons: Dialog.Ok | Dialog.Cancel
modal: true
contentItem: ColumnLayout {
Text {
id: content
}
TextArea {
id: input
Layout.fillWidth: true
}
}
onAccepted: {
dialogBridge.onAcceptedWithInput(pointer, plugin, callbackId, input.text)
}
onRejected: {
dialogBridge.onRejectedWithInput(pointer, plugin, callbackId, input.text)
}
onWidthChanged: {
window.width = implicitWidth
}
onHeightChanged: {
window.height = implicitHeight
}
}
Component.onCompleted: {
dialog.open()
}
}