【发布时间】:2018-03-04 23:54:56
【问题描述】:
Usage of the signal currentIndexChanged is clear, it's triggered when a different item from combobox is selected.但我正面临另一个信号的问题。 editTextChanged 会在用户手动更改组合框的editText 时触发,同时也会在选择组合框中的另一个项目时触发,因此editTextChanged 和currentIndexChanged 都会被触发。
我的问题是我需要知道这两种可能性中的哪一种发生在我的插槽on_comboBox_editTextChanged() 中,是文本被覆盖还是选择了不同的项目。从我看到的情况来看,插槽on_comboBox_editTextChanged()被称为第一个,所以我不知道如何在插槽中实现这个信息。
我在QComboBox 类中没有找到任何可以解决它的东西。那么问题来了,如何区分editTextChanged是因为index被改变还是用户覆盖了editText而触发的?
【问题讨论】: