diff --git a/base/ModalHelpers.qml b/base/ModalHelpers.qml new file mode 100644 index 0000000..9112c95 --- /dev/null +++ b/base/ModalHelpers.qml @@ -0,0 +1,59 @@ +import QtQuick 2.14 + +import StatusQ.Core 0.1 +import StatusQ.Conntrols 0.1 + +QtObject { + id: root + + property var target: null + + property var header: null + property var footer: null + property var contentItem: null + + Component { + id: headerComp + QtObject { + property StatusbBaseText title + property StatusbBaseText subtitle + property StatusRoundImage avatar + 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 + } + } +} diff --git a/ui-tests.pro b/ui-tests.pro index 6c2e81e..2a1ca6b 100644 --- a/ui-tests.pro +++ b/ui-tests.pro @@ -9,6 +9,7 @@ DEFINES += PROJECT_PATH=\"$${PWD}\" DISTFILES += \ base/ChatsModelData.qml \ base/Helpers.qml \ + base/ModalHelpers.qml \ base/ProfileModelData.qml \ base/WindowTestCase.qml \ tst_choose_chat_name_modal.qml \