diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-10-07 15:01:26 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-12 06:12:29 +0000 |
commit | 65efbd390b707f64b26a1449be38393199530861 (patch) | |
tree | faa6c9bc80d677c0a9f18d854467d03d181412d3 /src/qmlmodels/qqmllistmodel.cpp | |
parent | e79efd598a31100751c9dcaf89cdd09c2737bf37 (diff) |
QQmlListModel: emit dataChange signal when updating the translations
We can't really track the individual bindings. Updating all string
fields is a blunt thing to do, but it always works and it's not worse
than what we did before the translation binding optimization.
Fixes: QTBUG-107208
Change-Id: I96b86c979b3168f052af4685874741f674e3337f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 53fa870971c23f932aebcaca6e5393aadd081e54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmlmodels/qqmllistmodel.cpp')
-rw-r--r-- | src/qmlmodels/qqmllistmodel.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index 94bb5d6c02..1019a367a8 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -2518,6 +2518,16 @@ void QQmlListModel::updateTranslations() if (m_dynamicRoles) return; Q_ASSERT(m_listModel); + + QList<int> roles; + for (int i = 0, end = m_listModel->roleCount(); i != end; ++i) { + if (m_listModel->getExistingRole(i).type == ListLayout::Role::String) + roles.append(i); + } + + if (!roles.isEmpty()) + emitItemsChanged(0, rowCount(QModelIndex()), roles); + m_listModel->updateTranslations(); } |