From 10c6ff1181e0ab6cac48539682324dd2393a4dfd Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 9 Feb 2023 16:09:10 +0200 Subject: [PATCH] Enum QVariant::Type is deprecated. --- src/app/valentina/core/vformulaproperty.cpp | 15 ++++++++- .../plugins/Vector3d/vvector3dproperty.cpp | 30 ++++++++++++++--- .../plugins/vboolproperty.cpp | 15 ++++++++- .../plugins/vcolorproperty.cpp | 7 +++- .../plugins/vemptyproperty.cpp | 7 +++- .../plugins/venumproperty.cpp | 16 +++++++++- .../plugins/vfileproperty.cpp | 8 ++++- .../plugins/vlabelproperty.cpp | 15 ++++++++- .../plugins/vlinecolorproperty.cpp | 16 +++++++++- .../plugins/vlinetypeproperty.cpp | 16 +++++++++- .../plugins/vnumberproperty.cpp | 32 +++++++++++++++++-- .../plugins/vobjectproperty.cpp | 16 +++++++++- .../plugins/vpointfproperty.cpp | 19 ++++++++++- .../plugins/vshortcutproperty.cpp | 7 +++- .../plugins/vstringproperty.cpp | 16 +++++++++- .../plugins/vtextproperty.cpp | 15 ++++++++- .../plugins/vwidgetproperty.cpp | 9 +++++- src/libs/vpropertyexplorer/vfileproperty_p.h | 8 ++++- src/libs/vpropertyexplorer/vproperty.cpp | 15 ++++++++- src/libs/vpropertyexplorer/vproperty.h | 9 +++++- .../vpropertyexplorer/vwidgetproperty_p.h | 8 ++++- 21 files changed, 273 insertions(+), 26 deletions(-) diff --git a/src/app/valentina/core/vformulaproperty.cpp b/src/app/valentina/core/vformulaproperty.cpp index 9e64d7549..7a4e4b666 100644 --- a/src/app/valentina/core/vformulaproperty.cpp +++ b/src/app/valentina/core/vformulaproperty.cpp @@ -37,7 +37,12 @@ //--------------------------------------------------------------------------------------------------------------------- VFormulaProperty::VFormulaProperty(const QString &name) - : VProperty(name, static_cast(VFormula::FormulaTypeId())) + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + static_cast(VFormula::FormulaTypeId())) +#else + static_cast(VFormula::FormulaTypeId())) +#endif { d_ptr->type = VPE::Property::Complex; @@ -183,11 +188,19 @@ void VFormulaProperty::SetFormula(const VFormula &formula) QVariant value; value.setValue(formula); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + value.convert(QMetaType(VFormula::FormulaTypeId())); +#else value.convert(VFormula::FormulaTypeId()); +#endif VProperty::d_ptr->VariantValue = value; QVariant tmpFormula(formula.GetFormula()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + tmpFormula.convert(QMetaType(QMetaType::QString)); +#else tmpFormula.convert(QVariant::String); +#endif VProperty::d_ptr->Children.at(0)->setValue(tmpFormula); diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp index 519b5e92d..487808178 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp @@ -28,9 +28,19 @@ #include "../vnumberproperty.h" VPE::QVector3DProperty::QVector3DProperty(const QString& name) - : VProperty(name, QVariant::String) // todo: QVariant::Vector3D?? + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString) // todo: QVariant::Vector3D?? +#else + QVariant::String) // todo: QVariant::Vector3D?? +#endif { - QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double); + QVariant tmpFloat(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + tmpFloat.convert(QMetaType(QMetaType::Double)); +#else + tmpFloat.convert(QVariant::Double); +#endif auto* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false); auto* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->setUpdateBehaviour(true, false); auto* tmpZ = new VDoubleProperty("Z"); addChild(tmpZ); tmpZ->setUpdateBehaviour(true, false); @@ -94,9 +104,19 @@ void VPE::QVector3DProperty::setVector(double x, double y, double z) return; } - QVariant tmpX(x); tmpX.convert(QVariant::Double); - QVariant tmpY(y); tmpY.convert(QVariant::Double); - QVariant tmpZ(z); tmpZ.convert(QVariant::Double); + QVariant tmpX(x); + QVariant tmpY(y); + QVariant tmpZ(z); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + tmpX.convert(QMetaType(QMetaType::Double)); + tmpY.convert(QMetaType(QMetaType::Double)); + tmpZ.convert(QMetaType(QMetaType::Double)); +#else + tmpX.convert(QVariant::Double); + tmpY.convert(QVariant::Double); + tmpZ.convert(QVariant::Double); +#endif d_ptr->Children.at(0)->setValue(tmpX); d_ptr->Children.at(1)->setValue(tmpY); d_ptr->Children.at(2)->setValue(tmpZ); diff --git a/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp b/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp index db7ada18e..5a168035d 100644 --- a/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp @@ -28,10 +28,19 @@ #include "../vproperty_p.h" VPE::VBoolProperty::VBoolProperty(const QString& name) : - VProperty(name, QVariant::Bool) + VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Bool) +#else + QVariant::Bool) +#endif { d_ptr->VariantValue.setValue(false); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::Bool)); +#else d_ptr->VariantValue.convert(QVariant::Bool); +#endif } @@ -99,7 +108,11 @@ auto VPE::VBoolProperty::getEditorData(const QWidget *editor) const -> QVariant void VPE::VBoolProperty::setValue(const QVariant &value) { VProperty::d_ptr->VariantValue = value; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Bool)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Bool); +#endif if (VProperty::d_ptr->editor != nullptr) { diff --git a/src/libs/vpropertyexplorer/plugins/vcolorproperty.cpp b/src/libs/vpropertyexplorer/plugins/vcolorproperty.cpp index 4bf9a4fd7..88cd5785d 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vcolorproperty.cpp @@ -29,7 +29,12 @@ #include "vcolorpropertyeditor.h" VPE::VColorProperty::VColorProperty(const QString &name) : - VProperty(name, QVariant::Color) + VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QColor) +#else + QVariant::Color) +#endif { } diff --git a/src/libs/vpropertyexplorer/plugins/vemptyproperty.cpp b/src/libs/vpropertyexplorer/plugins/vemptyproperty.cpp index ec038cff3..e9d5874b5 100644 --- a/src/libs/vpropertyexplorer/plugins/vemptyproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vemptyproperty.cpp @@ -33,7 +33,12 @@ class VPropertyPrivate; } // namespace VPE VPE::VEmptyProperty::VEmptyProperty(const QString& name) - : VProperty(name, QVariant::Invalid) + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::UnknownType) +#else + QVariant::Invalid) +#endif { } diff --git a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp index 62e7b61cb..c35bae91d 100644 --- a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp @@ -28,10 +28,20 @@ #include "../vproperty_p.h" VPE::VEnumProperty::VEnumProperty(const QString& name) - : VProperty(name, QVariant::Int), EnumerationLiterals() + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Int), +#else + QVariant::Int), +#endif + EnumerationLiterals() { VProperty::d_ptr->VariantValue = 0; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif } @@ -115,7 +125,11 @@ void VPE::VEnumProperty::setValue(const QVariant& value) } VProperty::d_ptr->VariantValue = tmpIndex; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif if (VProperty::d_ptr->editor != nullptr) { diff --git a/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp b/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp index 2322549dd..aa480c578 100644 --- a/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp @@ -30,7 +30,13 @@ #include "../vproperty_p.h" VPE::VFileProperty::VFileProperty(const QString& name) - : VProperty(new VFilePropertyPrivate(name, QVariant::String)) + : VProperty( + new VFilePropertyPrivate(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString)) +#else + QVariant::String)) +#endif { } diff --git a/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp index 09c2087ce..48e6edbf3 100644 --- a/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp @@ -36,12 +36,21 @@ #include "../vproperty_p.h" VPE::VLabelProperty::VLabelProperty(const QString &name, const QMap &settings) - : VProperty(name, QVariant::String), + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString), +#else + QVariant::String), +#endif typeForParent(0) { VProperty::setSettings(settings); d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } VPE::VLabelProperty::VLabelProperty(const QString &name) @@ -49,7 +58,11 @@ VPE::VLabelProperty::VLabelProperty(const QString &name) typeForParent(0) { d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } QWidget *VPE::VLabelProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, diff --git a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp index 57f543b4d..a148139cf 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp @@ -40,10 +40,20 @@ #include "../vproperty_p.h" VPE::VLineColorProperty::VLineColorProperty(const QString &name) - : VProperty(name, QVariant::Int), colors(), indexList() + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Int), +#else + QVariant::Int), +#endif + colors(), indexList() { VProperty::d_ptr->VariantValue = 0; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif } QVariant VPE::VLineColorProperty::data(int column, int role) const @@ -144,7 +154,11 @@ void VPE::VLineColorProperty::setValue(const QVariant &value) } VProperty::d_ptr->VariantValue = tmpIndex; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif if (VProperty::d_ptr->editor != nullptr) { diff --git a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp index 48ae5b724..b0f382996 100644 --- a/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp @@ -37,10 +37,20 @@ #include "../vproperty_p.h" VPE::VLineTypeProperty::VLineTypeProperty(const QString &name) - : VProperty(name, QVariant::Int), styles(), indexList() + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Int), +#else + QVariant::Int), +#endif + styles(), indexList() { VProperty::d_ptr->VariantValue = 0; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif } QVariant VPE::VLineTypeProperty::data(int column, int role) const @@ -137,7 +147,11 @@ void VPE::VLineTypeProperty::setValue(const QVariant &value) } VProperty::d_ptr->VariantValue = tmpIndex; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif if (VProperty::d_ptr->editor != nullptr) { diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp index bfc3078eb..16ff32c6f 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp @@ -45,21 +45,34 @@ const int VPE::VIntegerProperty::StandardMin = -1000000; const int VPE::VIntegerProperty::StandardMax = 1000000; VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap& settings) - : VProperty(name, QVariant::Int), + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Int), +#else + QVariant::Int), +#endif m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0) { VProperty::setSettings(settings); VProperty::d_ptr->VariantValue.setValue(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif } VPE::VIntegerProperty::VIntegerProperty(const QString &name) : VProperty(name), m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0) { VProperty::d_ptr->VariantValue.setValue(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Int)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Int); +#endif } //! Returns an editor widget, or NULL if it doesn't supply one @@ -166,7 +179,13 @@ const int VPE::VDoubleProperty::StandardMax = 1000000; const double VPE::VDoubleProperty::StandardPrecision = 5; VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap& settings) - : VProperty(name, QVariant::Double), + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Double), +#else + QVariant::Double), +#endif + m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0), @@ -174,7 +193,11 @@ VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMapVariantValue.setValue(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Double)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::Double); +#endif } VPE::VDoubleProperty::VDoubleProperty(const QString &name) @@ -185,8 +208,13 @@ VPE::VDoubleProperty::VDoubleProperty(const QString &name) m_precision(static_cast(StandardPrecision)) { VProperty::d_ptr->VariantValue.setValue(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::Double)); + VProperty::d_ptr->PropertyVariantType = QMetaType::Double; +#else VProperty::d_ptr->VariantValue.convert(QVariant::Double); VProperty::d_ptr->PropertyVariantType = QVariant::Double; +#endif } //! Returns an editor widget, or NULL if it doesn't supply one diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp index 31f3021dc..669e5ff20 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp @@ -28,10 +28,20 @@ #include "../vproperty_p.h" VPE::VObjectProperty::VObjectProperty(const QString& name) - : VProperty(name, QVariant::Int), objects() + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::UInt), +#else + QVariant::UInt), +#endif + objects() { VProperty::d_ptr->VariantValue = 0; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::UInt)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::UInt); +#endif } //! Get the data how it should be displayed @@ -130,7 +140,11 @@ QMap VPE::VObjectProperty::getObjects() const void VPE::VObjectProperty::setValue(const QVariant& value) { VProperty::d_ptr->VariantValue = value; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + VProperty::d_ptr->VariantValue.convert(QMetaType(QMetaType::UInt)); +#else VProperty::d_ptr->VariantValue.convert(QVariant::UInt); +#endif if (VProperty::d_ptr->editor != nullptr) { diff --git a/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp b/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp index 41cf1ef0f..1641a0279 100644 --- a/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp @@ -28,10 +28,19 @@ #include "vnumberproperty.h" VPE::VPointFProperty::VPointFProperty(const QString &name) - : VProperty(name, QVariant::PointF) + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QPointF) +#else + QVariant::PointF) +#endif { d_ptr->VariantValue.setValue(0); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QPointF)); +#else d_ptr->VariantValue.convert(QVariant::PointF); +#endif VDoubleProperty* tmpX = new VDoubleProperty("X"); addChild(tmpX); @@ -92,10 +101,18 @@ void VPE::VPointFProperty::setPointF(qreal x, qreal y) } QVariant tmpX(x); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + tmpX.convert(QMetaType(QMetaType::Double)); +#else tmpX.convert(QVariant::Double); +#endif QVariant tmpY(y); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + tmpY.convert(QMetaType(QMetaType::Double)); +#else tmpY.convert(QVariant::Double); +#endif d_ptr->Children.at(0)->setValue(tmpX); d_ptr->Children.at(1)->setValue(tmpY); diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.cpp b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.cpp index 18264a9fc..5829de611 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vshortcutproperty.cpp @@ -29,7 +29,12 @@ #include "vshortcutpropertyeditor.h" VPE::VShortcutProperty::VShortcutProperty(const QString& name) - : VProperty(name, QVariant::String) + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString) +#else + QVariant::String) +#endif { } diff --git a/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp b/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp index 33710c006..d98829d26 100644 --- a/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp @@ -30,18 +30,32 @@ #include "../vproperty_p.h" VPE::VStringProperty::VStringProperty(const QString &name, const QMap &settings) - : VProperty(name, QVariant::String), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false) + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString), +#else + QVariant::String), +#endif + readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false) { VProperty::setSettings(settings); d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } VPE::VStringProperty::VStringProperty(const QString &name) : VProperty(name), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false) { d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, diff --git a/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp b/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp index 3fc40a521..21f427088 100644 --- a/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp @@ -50,12 +50,21 @@ void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar) VPE::VTextProperty::VTextProperty(const QString &name, const QMap &settings) - : VProperty(name, QVariant::String), + : VProperty(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::QString), +#else + QVariant::String), +#endif readOnly(false) { VProperty::setSettings(settings); d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } VPE::VTextProperty::VTextProperty(const QString &name) @@ -63,7 +72,11 @@ VPE::VTextProperty::VTextProperty(const QString &name) readOnly(false) { d_ptr->VariantValue.setValue(QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(QMetaType::QString)); +#else d_ptr->VariantValue.convert(QVariant::String); +#endif } QWidget *VPE::VTextProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, diff --git a/src/libs/vpropertyexplorer/plugins/vwidgetproperty.cpp b/src/libs/vpropertyexplorer/plugins/vwidgetproperty.cpp index 856a91e71..4ce5de38e 100644 --- a/src/libs/vpropertyexplorer/plugins/vwidgetproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vwidgetproperty.cpp @@ -29,7 +29,14 @@ #include "../vproperty.h" VPE::VWidgetProperty::VWidgetProperty(const QString& name, QWidget* widget) - : VEmptyProperty(new VWidgetPropertyPrivate(name, QVariant::Invalid, widget)) + : VEmptyProperty( + new VWidgetPropertyPrivate(name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::UnknownType, +#else + QVariant::Invalid, +#endif + widget)) { } diff --git a/src/libs/vpropertyexplorer/vfileproperty_p.h b/src/libs/vpropertyexplorer/vfileproperty_p.h index 839d05e86..753c3d000 100644 --- a/src/libs/vpropertyexplorer/vfileproperty_p.h +++ b/src/libs/vpropertyexplorer/vfileproperty_p.h @@ -39,7 +39,13 @@ public: //! Constructor passing name and type - VFilePropertyPrivate(const QString& name, QVariant::Type type, bool directory = false) + VFilePropertyPrivate(const QString& name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Type type, +#else + QVariant::Type type, +#endif + bool directory = false) : VPropertyPrivate(name, type), FileFilters(), Directory(directory) {} //! Constructor diff --git a/src/libs/vpropertyexplorer/vproperty.cpp b/src/libs/vpropertyexplorer/vproperty.cpp index b74cc5da0..612de59a9 100644 --- a/src/libs/vpropertyexplorer/vproperty.cpp +++ b/src/libs/vpropertyexplorer/vproperty.cpp @@ -33,7 +33,12 @@ #include "vproperty_p.h" //! Standard constructor, takes a name and a parent property as argument -VPE::VProperty::VProperty(const QString& name, QVariant::Type type) +VPE::VProperty::VProperty(const QString& name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Type type) +#else + QVariant::Type type) +#endif : QObject(), d_ptr(new VPropertyPrivate(name, type)) { @@ -114,7 +119,11 @@ QWidget* VPE::VProperty::createEditor(QWidget * parent, const QStyleOptionViewIt QItemEditorFactory *factory = new QItemEditorFactory; QItemEditorCreatorBase *lineCreator = new QStandardItemEditorCreator(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + factory->registerEditor(QMetaType::QString, lineCreator); +#else factory->registerEditor(QVariant::String, lineCreator); +#endif QItemEditorFactory::setDefaultFactory(factory); d_ptr->editor = factory->createEditor(static_cast(d_ptr->PropertyVariantType), parent); @@ -178,7 +187,11 @@ Qt::ItemFlags VPE::VProperty::flags(int column) const void VPE::VProperty::setValue(const QVariant &value) { d_ptr->VariantValue = value; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + d_ptr->VariantValue.convert(QMetaType(d_ptr->PropertyVariantType)); +#else d_ptr->VariantValue.convert(static_cast(d_ptr->PropertyVariantType)); +#endif if (d_ptr->editor != nullptr) { setEditorData(d_ptr->editor); diff --git a/src/libs/vpropertyexplorer/vproperty.h b/src/libs/vpropertyexplorer/vproperty.h index a4488d549..a3a8c3700 100644 --- a/src/libs/vpropertyexplorer/vproperty.h +++ b/src/libs/vpropertyexplorer/vproperty.h @@ -42,6 +42,8 @@ #include +#include "vpropertydef.h" + template class QList; namespace VPE @@ -75,7 +77,12 @@ public: }; //! Standard constructor, takes a name and a parent property as argument - explicit VProperty(const QString& name, QVariant::Type type = QVariant::String); + explicit VProperty(const QString& name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Type type = QMetaType::QString); +#else + QVariant::Type type = QVariant::String); +#endif //! Destructor virtual ~VProperty() override; diff --git a/src/libs/vpropertyexplorer/vwidgetproperty_p.h b/src/libs/vpropertyexplorer/vwidgetproperty_p.h index b31c9439c..fd5622eb3 100644 --- a/src/libs/vpropertyexplorer/vwidgetproperty_p.h +++ b/src/libs/vpropertyexplorer/vwidgetproperty_p.h @@ -44,7 +44,13 @@ public: QPointer Widget; //! Constructor passing name and type - VWidgetPropertyPrivate(const QString& name, QVariant::Type type, QWidget* widget = nullptr) + VWidgetPropertyPrivate(const QString& name, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QMetaType::Type type, +#else + QVariant::Type type, +#endif + QWidget* widget = nullptr) : VPropertyPrivate(name, type), Widget(widget) {} //! Constructor