import QtQuick import QtQuick.Controls.Basic import QtQuick.Layouts import Linphone import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils RowLayout { id: mainItem property string titleText property string subTitleText property string propertyName property var propertyOwner property var propertyOwnerGui property alias entries: comboBox.model property alias model: comboBox.model property alias textRole: comboBox.textRole property alias flagRole: comboBox.flagRole property alias currentIndex: comboBox.currentIndex property alias currentValue: comboBox.currentValue property alias listView: comboBox.listView spacing: Utils.getSizeWithScreenRatio(20) ColumnLayout { Layout.minimumHeight: Utils.getSizeWithScreenRatio(32) Layout.fillWidth: true spacing: Utils.getSizeWithScreenRatio(4) visible: titleText.length > 0 Text { text: titleText font: Typography.p2l wrapMode: Text.WordWrap color: DefaultStyle.main2_600 Layout.fillWidth: true } Text { text: subTitleText font: Typography.p1 wrapMode: Text.WordWrap visible: subTitleText.length > 0 color: DefaultStyle.main2_600 Layout.fillWidth: true } } ComboBox { id: comboBox Layout.alignment: titleText.length > 0 ? (Qt.AlignRight | Qt.AlignVCenter) : Qt.AlignLeft Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) Layout.preferredWidth: titleText.length > 0 ? Utils.getSizeWithScreenRatio(200) : undefined Layout.fillWidth: titleText.length === 0 oneLine: true currentIndex: Utils.findIndex(model, function (entry) { if(propertyOwnerGui) return Utils.equalObject(entry, propertyOwnerGui.core[mainItem.propertyName]) else return Utils.equalObject(entry, propertyOwner[mainItem.propertyName]) }) onCurrentValueChanged: { if(propertyOwnerGui) { binding.when = !Utils.equalObject(currentValue, propertyOwnerGui.core[mainItem.propertyName]) } else { binding.when = !Utils.equalObject(currentValue, propertyOwner[mainItem.propertyName]) } } Binding { id: binding target: propertyOwnerGui ? propertyOwnerGui.core : propertyOwner property: mainItem.propertyName value: comboBox.currentValue when: false } } }