请问怎么让combo box选定的内容显示到list box中呀?

![img](https://img-mid.csdnimg.cn/re

img


lease/static/image/mid/ask/872315534586137.png "#left")

img

combox属性双击CBN_SELCHANGE,添加代码即可


connect(&comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [&](int index){
        // 清空列表框
        listBox.clear();

        // 获取选中的项文本
        QString selectedItem = comboBox.itemText(index);

        // 将选中的项添加到列表框中
        listBox.addItem(selectedItem);
    });