mobile/UI: add template for editable combo box

This makes the code easier to read and manage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-12-30 12:22:18 -08:00
parent 48c3e017d6
commit d6456d490f
3 changed files with 31 additions and 40 deletions

View file

@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-2.0
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import org.kde.kirigami 2.4 as Kirigami
// this reuses our themed combo box, but makes it editable and behave consistently
// for the dive edit page - this reduces redundant code on that page
TemplateComboBox {
id: ecb
editable: true
inputMethodHints: Qt.ImhNoPredictiveText
onActivated: {
focus = false
}
onAccepted: {
focus = false
}
onEditTextChanged: { // this allows us to set the initial text in DiveDetails / startEditMode()
displayText = editText
}
}