broulik added a comment.
I checked Qt source code and Qt indeed should handle this on its own, it also
works fine hwere without the code.
Worse, the explicit assignment from QML breaks any binding set on
`currentIndex`.
In the handler that's called when the delegate model creates a delegate it
does the following
void QQuickComboBoxPrivate::createdItem(int index, QObject *object)
{
...
QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton
*>(object);
if (button) {
button->setFocusPolicy(Qt::NoFocus);
connect(button, &QQuickAbstractButton::clicked, this,
&QQuickComboBoxPrivate::itemClicked);
connect(button, &QQuickAbstractButton::hoveredChanged, this,
&QQuickComboBoxPrivate::itemHovered);
}
`ItemDelegate` is an `AbstractButton` and in `itemClicked` it sets the
`currentIndex` and emits `activated`.
REPOSITORY
R858 Qt Quick Controls 2: Desktop Style
REVISION DETAIL
https://phabricator.kde.org/D18299
To: apol, #frameworks, davidedmundson
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas,
GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed,
jensreuterberg, abetts, sebas, apol, ahiemstra, mart