linphone-desktop/Linphone/view/Control/Container/FormItemLayout.qml
Gaelle Braud 82e4da60ee try to fix #LINQT-1605 (CI needed to check the result)
fix typo

fix #LINQT-1570 bad username in participants device stickers, use participant address

fix #LINQT-1626 remote address contains gruu in transfered call

fix #LINQT-1621 ensure visible when error visible on form item
2025-01-31 10:16:15 +01:00

75 lines
1.8 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Effects
import Linphone
FocusScope{
id: mainItem
property alias contentItem: contentItem.data
property string label: ""
property bool mandatory: false
property alias errorTextItem: errorText
property alias errorMessage: errorText.text
property bool enableErrorText: false
property bool errorTextVisible: errorText.isVisible
implicitHeight: layout.implicitHeight
function clearErrorText() {
errorText.clear()
}
onErrorMessageChanged: if (errorMessage.length > 0) {
var item = mainItem
do {
var parentItem = item.parent
if (parentItem.contentItem) {
if (parentItem.contentY >= mainItem.y)
parentItem.contentY = mainItem.y;
else if (parentItem.contentY+height <= mainItem.y+mainItem.height)
parentItem.contentY = mainItem.y + mainItem.height - height;
}
item = parentItem
} while(item.parent != undefined && parentItem.contentItem === undefined)
}
ColumnLayout {
id: layout
spacing: 5 * DefaultStyle.dp
anchors.left: parent.left
anchors.right: parent.right
Text {
visible: label.length > 0
verticalAlignment: Text.AlignVCenter
text: mainItem.label + (mainItem.mandatory ? "*" : "")
color: contentItem.activeFocus ? DefaultStyle.main1_500_main : DefaultStyle.main2_600
elide: Text.ElideRight
wrapMode: Text.Wrap
maximumLineCount: 1
textFormat: Text.RichText
font {
pixelSize: 13 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
}
}
Item {
Layout.preferredHeight: childrenRect.height
Layout.fillWidth: true
StackLayout {
id: contentItem
height: childrenRect.height
anchors.left: parent.left
anchors.right: parent.right
}
TemporaryText {
id: errorText
anchors.top: contentItem.bottom
color: DefaultStyle.danger_500main
}
}
}
}