diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index beba05c01ec..92c9afc6d85 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -384,11 +384,16 @@ void QPropertyObserverPointer::observeProperty(QPropertyBasePointer property) property.addObserver(ptr); } -QPropertyBindingError::QPropertyBindingError(Type type) +QPropertyBindingError::QPropertyBindingError() +{ +} + +QPropertyBindingError::QPropertyBindingError(Type type, const QString &description) { if (type != NoError) { d = new QPropertyBindingErrorPrivate; d->type = type; + d->description = description; } } @@ -425,13 +430,6 @@ QPropertyBindingError::Type QPropertyBindingError::type() const return d->type; } -void QPropertyBindingError::setDescription(const QString &description) -{ - if (!d) - d = new QPropertyBindingErrorPrivate; - d->description = description; -} - QString QPropertyBindingError::description() const { if (!d) @@ -439,13 +437,6 @@ QString QPropertyBindingError::description() const return d->description; } -QPropertyBindingSourceLocation QPropertyBindingError::location() const -{ - if (!d) - return QPropertyBindingSourceLocation(); - return d->location; -} - /*! \class QProperty \inmodule QtCore diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 994eb24cea3..986c6afbc91 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -99,17 +99,18 @@ public: UnknownError }; - QPropertyBindingError(Type type = NoError); + QPropertyBindingError(); + QPropertyBindingError(Type type, const QString &description = QString()); + QPropertyBindingError(const QPropertyBindingError &other); QPropertyBindingError &operator=(const QPropertyBindingError &other); QPropertyBindingError(QPropertyBindingError &&other); QPropertyBindingError &operator=(QPropertyBindingError &&other); ~QPropertyBindingError(); + bool hasError() const { return d.get() != nullptr; } Type type() const; - void setDescription(const QString &description); QString description() const; - QPropertyBindingSourceLocation location() const; private: QSharedDataPointer d; diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index f15181a0ae3..7b9d7c207ff 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -103,7 +103,6 @@ class QPropertyBindingErrorPrivate : public QSharedData public: QPropertyBindingError::Type type = QPropertyBindingError::NoError; QString description; - QPropertyBindingSourceLocation location; }; struct BindingEvaluationState diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 96cf6da4bb8..50a8d51a460 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -506,8 +506,7 @@ void tst_QProperty::bindingSourceLocation() void tst_QProperty::bindingError() { QProperty prop = Qt::makePropertyBinding([]() -> std::variant { - QPropertyBindingError error(QPropertyBindingError::UnknownError); - error.setDescription(QLatin1String("my error")); + QPropertyBindingError error(QPropertyBindingError::UnknownError, QLatin1String("my error")); return error; }); QCOMPARE(prop.value(), 0);