从 ComboBox 获取价值?

Get value from ComboBox?

我在 MyForm 中有一个 ComboBox (myComboBox ) 和 EnumType myEnumType .

modified方法中,我想获取值。

我使用的代码看起来像:

if (myComboBox.enumTypeValue() == myEnumType::Value1 )
{
//action
}

或另一种方式

if (myComboBox.enumType(myEnumType::Value1) )
{
//action
}

在这两种情况下我都不能取值。

路在何方?谢谢大家!

尽情享受吧!

要获取 ComboBox 的值,请使用 selection 方法,

if(myComboBox.selection() == myEnumType::Value1) {
   //action
}