Skip to content

Commit

Permalink
PingComboBox: Add first version compatible with SettingsManager
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Jul 5, 2018
1 parent 8b03b53 commit 19db1ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions qml/PingComboBox.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import QtQml 2.2
import QtQuick.Controls 2.2

ComboBox {
id: root
currentIndex: -1

property var setting

onCurrentTextChanged: {
// Empty string should not pass
// ComboBox start with it and emit a signal for that
if(!currentText){
return
}
setting = currentText
}

Component.onCompleted: {
// Load the correct model index
for(var i in model) {
if(model[i] == setting) {
currentIndex = i
return
}
}
}
}
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<file alias="MainPage.qml">qml/MainPage.qml</file>
<file alias="Ping1DVisualizer.qml">qml/Ping1DVisualizer.qml</file>
<file alias="PingButton.qml">qml/PingButton.qml</file>
<file alias="PingComboBox.qml">qml/PingComboBox.qml</file>
<file alias="PingItem.qml">qml/PingItem.qml</file>
<file alias="PingImage.qml">qml/PingImage.qml</file>
<file alias="PingLogger.qml">qml/PingLogger.qml</file>
Expand Down

0 comments on commit 19db1ef

Please sign in to comment.