D18299: ComboBox: fix default delegate
Kai Uwe Broulik
noreply at phabricator.kde.org
Wed Oct 16 14:35:23 BST 2019
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191016/d203e810/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list