I used below syntax in Qt5 according to new connect syntax to avoid type mismatches of slot and signals for a a QListWidget
with checkable items.
connect(item, &QListWidget::itemChanged,this , &mainWindow::checkItemChanged);
I want to run my slot in case any of list item changed its state. In order to this this I used itemChanged
signal due to this answer, but it is protected and compile time error raise as below:
error: ‘void QListWidget::itemChanged(QListWidgetItem*)’ is protected
How can I handles this? Should I subclass my own QListWidget
or there are some other solutions to this?
Qt5
?QListWidget::itemChanged
should bepublic
inQt5
but may have beenprotected
inQt4
. – G.M.Q_SIGNALS
macro which resolves to be public in Qt5 and protected for Qt4. You might use Qt4 connection style instead. – vahancho