Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd757bfe79 | ||
|
|
10e31737d2 | ||
|
|
684f45cc08 | ||
|
|
eae4e0f405 | ||
|
|
b2ac2794bb | ||
|
|
b565a32c7e | ||
|
|
a1835164d9 | ||
|
|
06e931d749 |
@@ -7,6 +7,42 @@ import StatusQ.Popups 0.1
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
/*!
|
||||
\qmltype StatusSeedPhraseInput
|
||||
\inherits Item
|
||||
\inqmlmodule StatusQ.Controls
|
||||
\since StatusQ.Controls 0.1
|
||||
\brief Displays a text input with suggestions. Inherits \l{https://doc.qt.io/qt-5/qml-qtquick-item.html}{Item}.
|
||||
|
||||
The \c StatusSeedPhraseInput item displays a text input with suggestions filtered based on the typed text.
|
||||
For example:
|
||||
|
||||
\qml
|
||||
StatusSeedPhraseInput {
|
||||
id: statusSeedInput
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
textEdit.input.anchors.leftMargin: 16
|
||||
textEdit.input.anchors.rightMargin: 16
|
||||
textEdit.input.anchors.topMargin: 11
|
||||
leftComponentText: "1"
|
||||
inputList: ListModel {
|
||||
ListElement {
|
||||
seedWord: "panda"
|
||||
}
|
||||
ListElement {
|
||||
seedWord: "posible"
|
||||
}
|
||||
ListElement {
|
||||
seedWord: "wing"
|
||||
}
|
||||
}
|
||||
}
|
||||
\endqml
|
||||
|
||||
For a list of components available see StatusQ.
|
||||
*/
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 162
|
||||
@@ -17,6 +53,10 @@ Item {
|
||||
property ListModel inputList: ListModel { }
|
||||
property ListModel filteredList: ListModel { }
|
||||
signal doneInsertingWord(string word)
|
||||
/*
|
||||
This signal is emitted when the user pressed a keyboard key and passes as a
|
||||
parameter the event. The corresponding handler is \c onKeyPressed.
|
||||
*/
|
||||
signal keyPressed(var event)
|
||||
signal editClicked()
|
||||
|
||||
@@ -48,7 +88,7 @@ Item {
|
||||
}
|
||||
}
|
||||
seedSuggestionsList.model = filteredList;
|
||||
if ((text.length === 3) && (filteredList.count === 1) &&
|
||||
if ((text.length === 4) && (filteredList.count === 1) &&
|
||||
((input.edit.keyEvent !== Qt.Key_Backspace) && (input.edit.keyEvent !== Qt.Key_Delete))) {
|
||||
seedWordInput.text = filteredList.get(0).seedWord;
|
||||
seedWordInput.input.edit.cursorPosition = seedWordInput.text.length;
|
||||
|
||||
Reference in New Issue
Block a user