Home > Mobile >  I want to ask a simple question about combobox in qt
I want to ask a simple question about combobox in qt

Time:03-24

This is my simplified QML code:

The import QtQuick 2.9
The import QtQuick. Windows 2.2
The import QtQuick. Controls 2.2
The Window {
ComboBox {
Id: comboBox
CurrentIndex: 0
TextRole: "key"
Model: ListModel {
The ListElement {key: "First"; Value: 10}
The ListElement {key: "the Second"; Value: 20}
}
}

The Timer {
Id: the timer
Interval: 1000
Running: true
Repeat: true
OnTriggered: {
The console. The log (comboBox. TextRole. Value)
}
}

}

Problem is how to use the console. The log () print combobox the current option value
I wrote is wrong, because just started to learn qt soon, o god
  •  Tags:  
  • Qt
  • Related