diff options
Diffstat (limited to 'src/widgets/itemviews/qitemeditorfactory.cpp')
-rw-r--r-- | src/widgets/itemviews/qitemeditorfactory.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 8ed2ee5f28..fe9b482122 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -91,7 +91,7 @@ class QUIntSpinBox : public QSpinBox Q_OBJECT Q_PROPERTY(uint value READ uintValue WRITE setUIntValue NOTIFY uintValueChanged USER true) public: - explicit QUIntSpinBox(QWidget *parent = 0) + explicit QUIntSpinBox(QWidget *parent = nullptr) : QSpinBox(parent) { connect(this, SIGNAL(valueChanged(int)), SIGNAL(uintValueChanged())); @@ -176,7 +176,7 @@ QWidget *QItemEditorFactory::createEditor(int userType, QWidget *parent) const QItemEditorCreatorBase *creator = creatorMap.value(userType, 0); if (!creator) { const QItemEditorFactory *dfactory = defaultFactory(); - return dfactory == this ? 0 : dfactory->createEditor(userType, parent); + return dfactory == this ? nullptr : dfactory->createEditor(userType, parent); } return creator->createWidget(parent); } @@ -241,21 +241,21 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) { switch (userType) { #if QT_CONFIG(combobox) - case QVariant::Bool: { + case QMetaType::Bool: { QBooleanComboBox *cb = new QBooleanComboBox(parent); cb->setFrame(false); cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); return cb; } #endif #if QT_CONFIG(spinbox) - case QVariant::UInt: { + case QMetaType::UInt: { QSpinBox *sb = new QUIntSpinBox(parent); sb->setFrame(false); sb->setMinimum(0); sb->setMaximum(INT_MAX); sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy()); return sb; } - case QVariant::Int: { + case QMetaType::Int: { QSpinBox *sb = new QSpinBox(parent); sb->setFrame(false); sb->setMinimum(INT_MIN); @@ -264,25 +264,25 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) return sb; } #endif #if QT_CONFIG(datetimeedit) - case QVariant::Date: { + case QMetaType::QDate: { QDateTimeEdit *ed = new QDateEdit(parent); ed->setFrame(false); return ed; } - case QVariant::Time: { + case QMetaType::QTime: { QDateTimeEdit *ed = new QTimeEdit(parent); ed->setFrame(false); return ed; } - case QVariant::DateTime: { + case QMetaType::QDateTime: { QDateTimeEdit *ed = new QDateTimeEdit(parent); ed->setFrame(false); return ed; } #endif #if QT_CONFIG(label) - case QVariant::Pixmap: + case QMetaType::QPixmap: return new QLabel(parent); #endif #if QT_CONFIG(spinbox) - case QVariant::Double: { + case QMetaType::Double: { QDoubleSpinBox *sb = new QDoubleSpinBox(parent); sb->setFrame(false); sb->setMinimum(-DBL_MAX); @@ -291,12 +291,12 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) return sb; } #endif #if QT_CONFIG(lineedit) - case QVariant::String: + case QMetaType::QString: default: { // the default editor is a lineedit QExpandingLineEdit *le = new QExpandingLineEdit(parent); - le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le)); - if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le)) + le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, nullptr, le)); + if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, nullptr, le)) le->setWidgetOwnsGeometry(true); return le; } #else @@ -304,42 +304,42 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) break; #endif } - return 0; + return nullptr; } QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const { switch (userType) { #if QT_CONFIG(combobox) - case QVariant::Bool: + case QMetaType::Bool: return "currentIndex"; #endif #if QT_CONFIG(spinbox) - case QVariant::UInt: - case QVariant::Int: - case QVariant::Double: + case QMetaType::UInt: + case QMetaType::Int: + case QMetaType::Double: return "value"; #endif #if QT_CONFIG(datetimeedit) - case QVariant::Date: + case QMetaType::QDate: return "date"; - case QVariant::Time: + case QMetaType::QTime: return "time"; - case QVariant::DateTime: + case QMetaType::QDateTime: return "dateTime"; #endif - case QVariant::String: + case QMetaType::QString: default: // the default editor is a lineedit return "text"; } } -static QItemEditorFactory *q_default_factory = 0; +static QItemEditorFactory *q_default_factory = nullptr; struct QDefaultFactoryCleaner { inline QDefaultFactoryCleaner() {} - ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = 0; } + ~QDefaultFactoryCleaner() { delete q_default_factory; q_default_factory = nullptr; } }; /*! |