diff --git a/widgets/DapComboBox.qml b/widgets/DapComboBox.qml index 67452ec29943fa42854b22b5cf7dce00b77fee78..b147f400a5c67dfd6940a631767ffee6ec42349f 100644 --- a/widgets/DapComboBox.qml +++ b/widgets/DapComboBox.qml @@ -3,6 +3,18 @@ import QtQuick.Controls 2.0 DapComboBoxForm { + Component.onCompleted: + { + if(isDefaultNeedToAppend && model.get(0, comboBoxTextRole[0]) !== mainLineText) + { + if(comboBoxTextRole[0] === "name") + model.insert(0, {name: mainLineText}); + else if(comboBoxTextRole[0] === "text") + model.insert(0, {text: mainLineText}); + currentIndex = 0; + } + } + delegate: ItemDelegate { diff --git a/widgets/DapComboBoxForm.ui.qml b/widgets/DapComboBoxForm.ui.qml index fab312f719112a6c1e04dcd830132582a58a142f..082ab1340d1a9d0620b74668ec71b7edab3b626a 100644 --- a/widgets/DapComboBoxForm.ui.qml +++ b/widgets/DapComboBoxForm.ui.qml @@ -84,6 +84,8 @@ ComboBox property var mainRow: [""] //@detalis mainLineText Text without unneccesary part. property string mainLineText + ///@details isDefaultNeedToAppend Sign to add default data to the beginning of model + property bool isDefaultNeedToAppend: false width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal @@ -134,8 +136,9 @@ ComboBox Text { anchors.verticalCenter: parent.verticalCenter + text: (popup.visible) ? - (index < mainRow.length ? mainRow[index] : ""): + (dapComboBox.currentIndex === -1 ? mainLineText : (index < mainRow.length ? mainRow[index] : "") ) : mainLineText font: popup.visible ? ((fontComboBox.length > index) ?