Qt 信号重载问题

Qt信号重载问题

例如QComBox的currentIndexChanged信号,包括

void QComboBox::currentIndexChanged(const QString &text)
void QComboBox::currentIndexChanged(int index)

根据官方手册中提示

  connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),[=](int index){ /* ... */ });

使用这种方式就可以解决

posted @ 2020-11-19 14:36  dump1ings  阅读(164)  评论(0编辑  收藏  举报