desktop-ui-tests/base/ModalHelpers.qml

60 lines
1.7 KiB
QML
Raw Permalink Normal View History

2021-10-15 08:39:32 +00:00
import QtQuick 2.14
import StatusQ.Core 0.1
2021-10-15 12:05:20 +00:00
import StatusQ.Controls 0.1
2021-10-15 08:39:32 +00:00
QtObject {
id: root
property var target: null
property var header: null
property var footer: null
property var contentItem: null
Component {
id: headerComp
QtObject {
2021-10-15 12:05:20 +00:00
property StatusBaseText title
property StatusBaseText subtitle
2021-10-15 12:48:53 +00:00
property StatusRoundedImage avatar
2021-10-15 08:39:32 +00:00
property StatusFlatRoundButton closeBtn
property var actionButton
}
}
function findInFooter(objectName) {
if (footer) {
return __helpers.getObjectByObjectName(footer, objectName)
}
return null;
}
function findInContent(objectName) {
if (contentItem) {
return __helpers.getObjectByObjectName(contentItem, objectName)
}
return null
}
property Helpers __helpers: Helpers {}
onTargetChanged: {
if (target) {
var hdr = __helpers.getObjectByObjectName(target.background, "statusModalHeader")
var headerNew = headerComp.createObject()
headerNew.title = __helpers.getObjectByObjectName(hdr, "headerTitle")
headerNew.subtitle = __helpers.getObjectByObjectName(hdr, "headerSubTitle")
headerNew.avatar = __helpers.getObjectByObjectName(hdr, "headerImage")
headerNew.closeBtn = __helpers.getObjectByObjectName(hdr, "headerCloseButton")
headerNew.actionButton = __helpers.getObjectByObjectName(hdr, "actionButtonLoader").item
root.header = headerNew
root.contentItem = target.contentItem
root.footer = target.footer
}
}
}