mirror of
https://github.com/status-im/desktop-ui-tests.git
synced 2025-01-25 20:18:52 +00:00
Merge pull request #9 from status-im/feat/modal-helpers
Add modal helpers for new modals
This commit is contained in:
commit
1b78c20a0d
59
base/ModalHelpers.qml
Normal file
59
base/ModalHelpers.qml
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
@ -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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user