-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PingComboBox: Add first version compatible with SettingsManager
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
- Loading branch information
1 parent
8b03b53
commit 19db1ef
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters