/
friendlyperch
/
QGrid
Обзор
Документация
Войти
/
friendlyperch
/
QGrid
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev-ver1
src/delegates/SpinBoxEditorDelegate.cpp
28 строк
647 B
okuntsev
new delegate approach
15 янв 2026, 12:58
15 янв 2026, 12:58
8e3ee23
Код
Авторство
О чём код?
#include "SpinBoxEditorDelegate.h" #include <QSpinBox> #include <QVariant> QWidget *SpinBoxEditorDelegate::createEditor(QWidget *parent) const { return new QSpinBox(parent); } void SpinBoxEditorDelegate::setEditorData(QWidget *editor, const QVariant &data) const { QSpinBox *spinBox = qobject_cast<QSpinBox *>(editor); if (spinBox) { spinBox->setValue(data.toInt()); } } QVariant SpinBoxEditorDelegate::getEditorData(QWidget *editor) const { QSpinBox *spinBox = qobject_cast<QSpinBox *>(editor); if (spinBox) { return spinBox->value(); } return QVariant(); }