lwei24 |
2021-02-01 17:41 |
关于QComboBox鼠标点击出现的问题
在使用QComboBox时,出现这个错误Attempt to bind non-signal QComboBox::currentIndexChanged(int)。请问为什么会报这个错呢?代码如下:
m_comboBoxPro = new QComboBox(this); m_comboBoxPro->setStyleSheet("QComboBox{font-family:'SimHei';font-size:9; border:1px solid lightgray;}" "QComboBox QAbstractItemView::item {min-height: 16px;}" "QComboBox::drop-down{border-left-width: 1px;border-left-color: lightgray;border-left-style: solid; border-top-right-radius: 3px;border-bottom-right-radius: 3px;subcontrol-origin: padding;subcontrol-position: top right; width:20px;}" "QComboBox::down-arrow{image:url(:/res/pwd/arrowDown01.png)}" "QComboBox::down-arrow:hover{image:url(:/res/pwd/arrowDown01.png)}" "QComboBox::down-arrow:pressed{image:url(:/res/pwd/arrowDown01.png)}"); m_comboBoxPro->addItem(QString("123")); m_comboBoxPro->addItem(QString("456")); QStyledItemDelegate *delegate = new QStyledItemDelegate(this); m_comboBoxPro->setItemDelegate(delegate); m_comboBoxPro->resize(this->width()*45/100, this->height()*7/100); m_comboBoxPro->move(this->width()*20/100, this->height()*40/100); connect(m_comboBoxPro, SLOT(currentIndexChanged(int)), this, SLOT(slotClickedComboBox(int))); |
|