diff --git a/atomic_defi_design/Dex/Exchange/Trade/SweetDexComboBox.qml b/atomic_defi_design/Dex/Exchange/Trade/SweetDexComboBox.qml index 28b9319ec2..af46b73ca4 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/SweetDexComboBox.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/SweetDexComboBox.qml @@ -93,37 +93,26 @@ ComboBox anchors.rightMargin: 5 // Search input - DefaultTextField + SearchField { - id: input_coin_filter - background: Item - { - DefaultRectangle - { - anchors.fill: parent - anchors.rightMargin: 2 - } - } + id: tickerSearchField function reset() { - text = "" + textField.text = "" renewIndex() } - placeholderText: qsTr("Search") - - font.pixelSize: 16 + Layout.preferredWidth: parent.width - 10 + Layout.preferredHeight: 30 + Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - Layout.leftMargin: 0 - Layout.preferredHeight: 60 - Layout.rightMargin: 2 - Layout.topMargin: Layout.leftMargin + color: Dex.CurrentTheme.backgroundColor - onTextChanged: + textField.font.pixelSize: 16 + textField.onTextChanged: { - ticker_list.setFilterFixedString(text) + ticker_list.setFilterFixedString(textField.text) renewIndex() } @@ -144,31 +133,25 @@ ComboBox target: popup function onOpened() { - input_coin_filter.reset(); - input_coin_filter.forceActiveFocus(); + tickerSearchField.reset(); + tickerSearchField.forceActiveFocus(); } - function onClosed() { input_coin_filter.reset() } + function onClosed() { tickerSearchField.reset() } } } - Item + + DefaultListView { Layout.maximumHeight: popup.max_height - 100 Layout.fillWidth: true - implicitHeight: popup_list_view.contentHeight + 5 - DefaultListView + + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + DefaultMouseArea { - id: popup_list_view - // Scrollbar appears if this extra space is not added - model: control.popup.visible ? control.delegateModel : null - currentIndex: control.highlightedIndex anchors.fill: parent - anchors.rightMargin: 2 - - DefaultMouseArea - { - anchors.fill: parent - acceptedButtons: Qt.NoButton - } + acceptedButtons: Qt.NoButton } } } @@ -178,7 +161,7 @@ ComboBox width: parent.width y: -5 height: parent.height + 10 - border.width: 1 + radius: 10 } } diff --git a/atomic_defi_design/Dex/Exchange/Trade/TickerSelector.qml b/atomic_defi_design/Dex/Exchange/Trade/TickerSelector.qml index 797137caf8..4978fa75ee 100644 --- a/atomic_defi_design/Dex/Exchange/Trade/TickerSelector.qml +++ b/atomic_defi_design/Dex/Exchange/Trade/TickerSelector.qml @@ -34,19 +34,16 @@ SweetDexComboBox onCurrentValueChanged: { // User input - if(combo.index_changed) - { + if(combo.index_changed) { combo.index_changed = false // Set the ticker - if (currentValue !== undefined) + if(currentValue !== undefined) setPair(left_side, currentValue) } // List change - else - { + else { // Correct the index - if (currentText.indexOf(ticker) === -1) - { + if(currentText.indexOf(ticker) === -1) { const target_index = indexOfValue(ticker) if(currentIndex !== target_index) currentIndex = target_index