diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-30 16:04:34 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-10 18:03:15 +0200 |
commit | 7fa478d6667b1ba21fc84aaddb29b1ac740bf3ea (patch) | |
tree | ad18e99c5d3799b8a1f0e1753b5915e25e414224 | |
parent | 687bf591414017644ead1923c5bcc2059a6a2e29 (diff) | |
download | qttools-7fa478d6667b1ba21fc84aaddb29b1ac740bf3ea.tar.gz |
Property browser: pass QDate and QTime by value, not const reference
They're value types, packaging qint64 and int, respectively.
Change-Id: I644afd2c851a027645230a12dfa4cceebd780ac2
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r-- | src/shared/qtpropertybrowser/qteditorfactory.cpp | 21 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qteditorfactory.h | 11 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertymanager.cpp | 43 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtpropertymanager.h | 16 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtvariantproperty.cpp | 12 | ||||
-rw-r--r-- | src/shared/qtpropertybrowser/qtvariantproperty.h | 6 |
6 files changed, 53 insertions, 56 deletions
diff --git a/src/shared/qtpropertybrowser/qteditorfactory.cpp b/src/shared/qtpropertybrowser/qteditorfactory.cpp index 60ad54631..dfb3e92a5 100644 --- a/src/shared/qtpropertybrowser/qteditorfactory.cpp +++ b/src/shared/qtpropertybrowser/qteditorfactory.cpp @@ -1036,12 +1036,12 @@ class QtDateEditFactoryPrivate : public EditorFactoryPrivate<QDateEdit> Q_DECLARE_PUBLIC(QtDateEditFactory) public: - void slotPropertyChanged(QtProperty *property, const QDate &value); - void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max); - void slotSetValue(const QDate &value); + void slotPropertyChanged(QtProperty *property, QDate value); + void slotRangeChanged(QtProperty *property, QDate min, QDate max); + void slotSetValue(QDate value); }; -void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QDate &value) +void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, QDate value) { const auto it = m_createdEditors.constFind(property); if (it == m_createdEditors.constEnd()) @@ -1053,8 +1053,7 @@ void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const Q } } -void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property, - const QDate &min, const QDate &max) +void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property, QDate min, QDate max) { const auto it = m_createdEditors.constFind(property); if (it == m_createdEditors.constEnd()) @@ -1072,7 +1071,7 @@ void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property, } } -void QtDateEditFactoryPrivate::slotSetValue(const QDate &value) +void QtDateEditFactoryPrivate::slotSetValue(QDate value) { QObject *object = q_ptr->sender(); const QMap<QDateEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd(); @@ -1172,11 +1171,11 @@ class QtTimeEditFactoryPrivate : public EditorFactoryPrivate<QTimeEdit> Q_DECLARE_PUBLIC(QtTimeEditFactory) public: - void slotPropertyChanged(QtProperty *property, const QTime &value); - void slotSetValue(const QTime &value); + void slotPropertyChanged(QtProperty *property, QTime value); + void slotSetValue(QTime value); }; -void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QTime &value) +void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, QTime value) { const auto it = m_createdEditors.constFind(property); if (it == m_createdEditors.constEnd()) @@ -1188,7 +1187,7 @@ void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const Q } } -void QtTimeEditFactoryPrivate::slotSetValue(const QTime &value) +void QtTimeEditFactoryPrivate::slotSetValue(QTime value) { QObject *object = q_ptr->sender(); const QMap<QTimeEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd(); diff --git a/src/shared/qtpropertybrowser/qteditorfactory.h b/src/shared/qtpropertybrowser/qteditorfactory.h index 5a2095bef..84cd797cd 100644 --- a/src/shared/qtpropertybrowser/qteditorfactory.h +++ b/src/shared/qtpropertybrowser/qteditorfactory.h @@ -205,10 +205,9 @@ private: QScopedPointer<QtDateEditFactoryPrivate> d_ptr; Q_DECLARE_PRIVATE(QtDateEditFactory) Q_DISABLE_COPY_MOVE(QtDateEditFactory) - Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QDate &)) - Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, - const QDate &, const QDate &)) - Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QDate &)) + Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, QDate)) + Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, QDate, QDate)) + Q_PRIVATE_SLOT(d_func(), void slotSetValue(QDate)) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *)) }; @@ -229,8 +228,8 @@ private: QScopedPointer<QtTimeEditFactoryPrivate> d_ptr; Q_DECLARE_PRIVATE(QtTimeEditFactory) Q_DISABLE_COPY_MOVE(QtTimeEditFactory) - Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QTime &)) - Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QTime &)) + Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, QTime)) + Q_PRIVATE_SLOT(d_func(), void slotSetValue(QTime)) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *)) }; diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.cpp b/src/shared/qtpropertybrowser/qtpropertymanager.cpp index 2d5269415..42ef6ef2a 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/src/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -271,7 +271,7 @@ static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *ma void (PropertyManager::*propertyChangedSignal)(QtProperty *), void (PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), void (PropertyManager::*rangeChangedSignal)(QtProperty *, ValueChangeParameter, ValueChangeParameter), - QtProperty *property, const Value &minVal, const Value &maxVal, + QtProperty *property, ValueChangeParameter minVal, ValueChangeParameter maxVal, void (PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, ValueChangeParameter, ValueChangeParameter, ValueChangeParameter)) { @@ -1545,8 +1545,8 @@ public: QDate maxVal{QDate(9999, 12, 31)}; QDate minimumValue() const { return minVal; } QDate maximumValue() const { return maxVal; } - void setMinimumValue(const QDate &newMinVal) { setSimpleMinimumData(this, newMinVal); } - void setMaximumValue(const QDate &newMaxVal) { setSimpleMaximumData(this, newMaxVal); } + void setMinimumValue(QDate newMinVal) { setSimpleMinimumData(this, newMinVal); } + void setMaximumValue(QDate newMaxVal) { setSimpleMaximumData(this, newMaxVal); } }; QString m_format; @@ -1587,7 +1587,7 @@ QtDatePropertyManagerPrivate::QtDatePropertyManagerPrivate(QtDatePropertyManager */ /*! - \fn void QtDatePropertyManager::valueChanged(QtProperty *property, const QDate &value) + \fn void QtDatePropertyManager::valueChanged(QtProperty *property, QDate value) This signal is emitted whenever a property created by this manager changes its value, passing a pointer to the \a property and the new @@ -1597,7 +1597,7 @@ QtDatePropertyManagerPrivate::QtDatePropertyManagerPrivate(QtDatePropertyManager */ /*! - \fn void QtDatePropertyManager::rangeChanged(QtProperty *property, const QDate &minimum, const QDate &maximum) + \fn void QtDatePropertyManager::rangeChanged(QtProperty *property, QDate minimum, QDate maximum) This signal is emitted whenever a property created by this manager changes its range of valid dates, passing a pointer to the \a @@ -1667,7 +1667,7 @@ QString QtDatePropertyManager::valueText(const QtProperty *property) const } /*! - \fn void QtDatePropertyManager::setValue(QtProperty *property, const QDate &value) + \fn void QtDatePropertyManager::setValue(QtProperty *property, QDate value) Sets the value of the given \a property to \a value. @@ -1677,10 +1677,10 @@ QString QtDatePropertyManager::valueText(const QtProperty *property) const \sa value(), setRange(), valueChanged() */ -void QtDatePropertyManager::setValue(QtProperty *property, const QDate &val) +void QtDatePropertyManager::setValue(QtProperty *property, QDate val) { - void (QtDatePropertyManagerPrivate::*setSubPropertyValue)(QtProperty *, const QDate &) = 0; - setValueInRange<const QDate &, QtDatePropertyManagerPrivate, QtDatePropertyManager, const QDate>(this, d_ptr.data(), + void (QtDatePropertyManagerPrivate::*setSubPropertyValue)(QtProperty *, QDate) = 0; + setValueInRange<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, const QDate>(this, d_ptr.data(), &QtDatePropertyManager::propertyChanged, &QtDatePropertyManager::valueChanged, property, val, setSubPropertyValue); @@ -1695,9 +1695,9 @@ void QtDatePropertyManager::setValue(QtProperty *property, const QDate &val) \sa minimum(), setRange() */ -void QtDatePropertyManager::setMinimum(QtProperty *property, const QDate &minVal) +void QtDatePropertyManager::setMinimum(QtProperty *property, QDate minVal) { - setMinimumValue<const QDate &, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(this, d_ptr.data(), + setMinimumValue<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(this, d_ptr.data(), &QtDatePropertyManager::propertyChanged, &QtDatePropertyManager::valueChanged, &QtDatePropertyManager::rangeChanged, @@ -1713,9 +1713,9 @@ void QtDatePropertyManager::setMinimum(QtProperty *property, const QDate &minVal \sa maximum(), setRange() */ -void QtDatePropertyManager::setMaximum(QtProperty *property, const QDate &maxVal) +void QtDatePropertyManager::setMaximum(QtProperty *property, QDate maxVal) { - setMaximumValue<const QDate &, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(this, d_ptr.data(), + setMaximumValue<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(this, d_ptr.data(), &QtDatePropertyManager::propertyChanged, &QtDatePropertyManager::valueChanged, &QtDatePropertyManager::rangeChanged, @@ -1723,7 +1723,7 @@ void QtDatePropertyManager::setMaximum(QtProperty *property, const QDate &maxVal } /*! - \fn void QtDatePropertyManager::setRange(QtProperty *property, const QDate &minimum, const QDate &maximum) + \fn void QtDatePropertyManager::setRange(QtProperty *property, QDate minimum, QDate maximum) Sets the range of valid dates. @@ -1736,11 +1736,10 @@ void QtDatePropertyManager::setMaximum(QtProperty *property, const QDate &maxVal \sa setMinimum(), setMaximum(), rangeChanged() */ -void QtDatePropertyManager::setRange(QtProperty *property, const QDate &minVal, const QDate &maxVal) +void QtDatePropertyManager::setRange(QtProperty *property, QDate minVal, QDate maxVal) { - void (QtDatePropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, const QDate &, - const QDate &, const QDate &) = 0; - setBorderValues<const QDate &, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate>(this, d_ptr.data(), + void (QtDatePropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, QDate, QDate, QDate) = 0; + setBorderValues<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate>(this, d_ptr.data(), &QtDatePropertyManager::propertyChanged, &QtDatePropertyManager::valueChanged, &QtDatePropertyManager::rangeChanged, @@ -1803,7 +1802,7 @@ QtTimePropertyManagerPrivate::QtTimePropertyManagerPrivate(QtTimePropertyManager */ /*! - \fn void QtTimePropertyManager::valueChanged(QtProperty *property, const QTime &value) + \fn void QtTimePropertyManager::valueChanged(QtProperty *property, QTime value) This signal is emitted whenever a property created by this manager changes its value, passing a pointer to the \a property and the @@ -1853,15 +1852,15 @@ QString QtTimePropertyManager::valueText(const QtProperty *property) const } /*! - \fn void QtTimePropertyManager::setValue(QtProperty *property, const QTime &value) + \fn void QtTimePropertyManager::setValue(QtProperty *property, QTime value) Sets the value of the given \a property to \a value. \sa value(), valueChanged() */ -void QtTimePropertyManager::setValue(QtProperty *property, const QTime &val) +void QtTimePropertyManager::setValue(QtProperty *property, QTime val) { - setSimpleValue<const QTime &, QTime, QtTimePropertyManager>(d_ptr->m_values, this, + setSimpleValue<QTime, QTime, QtTimePropertyManager>(d_ptr->m_values, this, &QtTimePropertyManager::propertyChanged, &QtTimePropertyManager::valueChanged, property, val); diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.h b/src/shared/qtpropertybrowser/qtpropertymanager.h index 1c9caaed1..d737fb06d 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.h +++ b/src/shared/qtpropertybrowser/qtpropertymanager.h @@ -203,13 +203,13 @@ public: QDate maximum(const QtProperty *property) const; public Q_SLOTS: - void setValue(QtProperty *property, const QDate &val); - void setMinimum(QtProperty *property, const QDate &minVal); - void setMaximum(QtProperty *property, const QDate &maxVal); - void setRange(QtProperty *property, const QDate &minVal, const QDate &maxVal); + void setValue(QtProperty *property, QDate val); + void setMinimum(QtProperty *property, QDate minVal); + void setMaximum(QtProperty *property, QDate maxVal); + void setRange(QtProperty *property, QDate minVal, QDate maxVal); Q_SIGNALS: - void valueChanged(QtProperty *property, const QDate &val); - void rangeChanged(QtProperty *property, const QDate &minVal, const QDate &maxVal); + void valueChanged(QtProperty *property, QDate val); + void rangeChanged(QtProperty *property, QDate minVal, QDate maxVal); protected: QString valueText(const QtProperty *property) const override; void initializeProperty(QtProperty *property) override; @@ -232,9 +232,9 @@ public: QTime value(const QtProperty *property) const; public Q_SLOTS: - void setValue(QtProperty *property, const QTime &val); + void setValue(QtProperty *property, QTime val); Q_SIGNALS: - void valueChanged(QtProperty *property, const QTime &val); + void valueChanged(QtProperty *property, QTime val); protected: QString valueText(const QtProperty *property) const override; void initializeProperty(QtProperty *property) override; diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.cpp b/src/shared/qtpropertybrowser/qtvariantproperty.cpp index 0c3ccdb63..25a9d2dda 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.cpp +++ b/src/shared/qtpropertybrowser/qtvariantproperty.cpp @@ -299,9 +299,9 @@ public: void slotValueChanged(QtProperty *property, bool val); void slotValueChanged(QtProperty *property, const QString &val); void slotRegExpChanged(QtProperty *property, const QRegularExpression ®Exp); - void slotValueChanged(QtProperty *property, const QDate &val); - void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max); - void slotValueChanged(QtProperty *property, const QTime &val); + void slotValueChanged(QtProperty *property, QDate val); + void slotRangeChanged(QtProperty *property, QDate min, QDate max); + void slotValueChanged(QtProperty *property, QTime val); void slotValueChanged(QtProperty *property, const QDateTime &val); void slotValueChanged(QtProperty *property, const QKeySequence &val); void slotValueChanged(QtProperty *property, const QChar &val); @@ -521,12 +521,12 @@ void QtVariantPropertyManagerPrivate::slotRegExpChanged(QtProperty *property, co emit q_ptr->attributeChanged(varProp, m_regExpAttribute, QVariant(regExp)); } -void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, const QDate &val) +void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, QDate val) { valueChanged(property, QVariant(val)); } -void QtVariantPropertyManagerPrivate::slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max) +void QtVariantPropertyManagerPrivate::slotRangeChanged(QtProperty *property, QDate min, QDate max) { if (QtVariantProperty *varProp = m_internalToProperty.value(property, 0)) { emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min)); @@ -534,7 +534,7 @@ void QtVariantPropertyManagerPrivate::slotRangeChanged(QtProperty *property, con } } -void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, const QTime &val) +void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, QTime val) { valueChanged(property, QVariant(val)); } diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.h b/src/shared/qtpropertybrowser/qtvariantproperty.h index 2026f1569..77bc52681 100644 --- a/src/shared/qtpropertybrowser/qtvariantproperty.h +++ b/src/shared/qtpropertybrowser/qtvariantproperty.h @@ -122,9 +122,9 @@ private: Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &)) Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegularExpression &)) - Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &)) - Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &)) - Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &)) + Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, QDate)) + Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, QDate, QDate)) + Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, QTime)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDateTime &)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QKeySequence &)) Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QChar &)) |