diff options
| author | Albert Astals Cid <aacid@kde.org> | 2024-06-19 17:42:34 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-06-21 00:18:53 +0000 |
| commit | 319cca2e2b8679bc553e8ebf97505f0625ee1c94 (patch) | |
| tree | 6516be1bcd0bd8dec503083d7454e255301b4824 /src/widgets/doc/snippets/qitemdelegate/spinbox-delegate.cpp | |
| parent | 90a9ab2a472e5a9c796deb989ce5db2e099c4382 (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.cpp | 2 |
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); |
