Migration of QtMvvm from github
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
1.5 KiB

import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.0
MsgBoxBase {
id: _inputDialog
readonly property url inputUrl: QuickPresenter.inputViewFactory.getInputUrl(msgConfig.subType, msgConfig.viewProperties)
ColumnLayout {
anchors.fill: parent
Label {
id: _contentLabel
text: msgConfig.text.replace(/<\/p>/g, "</p><br/>") //needed because qml does not put space between paragraphs...
visible: text != ""
Layout.fillWidth: true
wrapMode: Text.Wrap
onLinkActivated: Qt.openUrlExternally(link)
}
ProgressBar {
id: _loadProgress
visible: _inputViewLoad.status == Loader.Loading
Layout.fillWidth: true
value: _inputViewLoad.progress
}
Label {
id: _errorLabel
visible: _inputViewLoad.status == Loader.Error
Layout.fillWidth: true
text: qsTr("<i>Failed to load input view for type: <b>%1</b></i>").arg(msgConfig.subType)
}
Loader {
id: _inputViewLoad
asynchronous: true
clip: true
visible: _inputViewLoad.item
Layout.preferredWidth: _inputViewLoad.item ? _inputViewLoad.item.implicitWidth : 0
Layout.fillHeight: true
Layout.fillWidth: true
onLoaded: {
msgResult.result = Qt.binding(function() {
return item.inputValue;
})
item.forceActiveFocus();
}
}
}
Component.onCompleted: {
var props = msgConfig.viewProperties;
props["inputValue"] = msgConfig.defaultValue;
_inputViewLoad.setSource(inputUrl, props);
}
}