summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2024-06-19 17:42:34 +0200
committerMarc Mutz <marc.mutz@qt.io>2024-06-21 00:18:53 +0000
commit319cca2e2b8679bc553e8ebf97505f0625ee1c94 (patch)
tree6516be1bcd0bd8dec503083d7454e255301b4824 /src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp
parent90a9ab2a472e5a9c796deb989ce5db2e099c4382 (diff)
Use QModelIndex::data()
idx.data(role) is much nicer to read than idx.model()->data(idx, role) As a drive-by, mark some QVariants const. Pick-to: 6.8 Change-Id: I00c0a5ac311a03095050b2542a5c396a6c1c2c6a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp')
-rw-r--r--src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp b/src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp
index efe8a167337..5a73d551b57 100644
--- a/src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp
+++ b/src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp
@@ -49,7 +49,7 @@ QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
void SpinBoxDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
- int value = index.model()->data(index, Qt::EditRole).toInt();
+ int value = index.data(Qt::EditRole).toInt();
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->setValue(value);