Enum QVariant::Type is deprecated.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 16:09:10 +02:00
parent 3e1c8a36d5
commit 10c6ff1181
21 changed files with 273 additions and 26 deletions

View file

@ -37,7 +37,12 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaProperty::VFormulaProperty(const QString &name) VFormulaProperty::VFormulaProperty(const QString &name)
: VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId())) : VProperty(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static_cast<QMetaType::Type>(VFormula::FormulaTypeId()))
#else
static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
#endif
{ {
d_ptr->type = VPE::Property::Complex; d_ptr->type = VPE::Property::Complex;
@ -183,11 +188,19 @@ void VFormulaProperty::SetFormula(const VFormula &formula)
QVariant value; QVariant value;
value.setValue(formula); value.setValue(formula);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
value.convert(QMetaType(VFormula::FormulaTypeId()));
#else
value.convert(VFormula::FormulaTypeId()); value.convert(VFormula::FormulaTypeId());
#endif
VProperty::d_ptr->VariantValue = value; VProperty::d_ptr->VariantValue = value;
QVariant tmpFormula(formula.GetFormula()); QVariant tmpFormula(formula.GetFormula());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
tmpFormula.convert(QMetaType(QMetaType::QString));
#else
tmpFormula.convert(QVariant::String); tmpFormula.convert(QVariant::String);
#endif
VProperty::d_ptr->Children.at(0)->setValue(tmpFormula); VProperty::d_ptr->Children.at(0)->setValue(tmpFormula);

View file

@ -28,9 +28,19 @@
#include "../vnumberproperty.h" #include "../vnumberproperty.h"
VPE::QVector3DProperty::QVector3DProperty(const QString& name) 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* tmpX = new VDoubleProperty("X"); addChild(tmpX); tmpX->setUpdateBehaviour(true, false);
auto* tmpY = new VDoubleProperty("Y"); addChild(tmpY); tmpY->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); 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; return;
} }
QVariant tmpX(x); tmpX.convert(QVariant::Double); QVariant tmpX(x);
QVariant tmpY(y); tmpY.convert(QVariant::Double); QVariant tmpY(y);
QVariant tmpZ(z); tmpZ.convert(QVariant::Double); 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(0)->setValue(tmpX);
d_ptr->Children.at(1)->setValue(tmpY); d_ptr->Children.at(1)->setValue(tmpY);
d_ptr->Children.at(2)->setValue(tmpZ); d_ptr->Children.at(2)->setValue(tmpZ);

View file

@ -28,10 +28,19 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VBoolProperty::VBoolProperty(const QString& name) : 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); 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); 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) void VPE::VBoolProperty::setValue(const QVariant &value)
{ {
VProperty::d_ptr->VariantValue = 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); VProperty::d_ptr->VariantValue.convert(QVariant::Bool);
#endif
if (VProperty::d_ptr->editor != nullptr) if (VProperty::d_ptr->editor != nullptr)
{ {

View file

@ -29,7 +29,12 @@
#include "vcolorpropertyeditor.h" #include "vcolorpropertyeditor.h"
VPE::VColorProperty::VColorProperty(const QString &name) : 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
{ {
} }

View file

@ -33,7 +33,12 @@ class VPropertyPrivate;
} // namespace VPE } // namespace VPE
VPE::VEmptyProperty::VEmptyProperty(const QString& name) 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
{ {
} }

View file

@ -28,10 +28,20 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VEnumProperty::VEnumProperty(const QString& name) 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
} }
@ -115,7 +125,11 @@ void VPE::VEnumProperty::setValue(const QVariant& value)
} }
VProperty::d_ptr->VariantValue = tmpIndex; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
if (VProperty::d_ptr->editor != nullptr) if (VProperty::d_ptr->editor != nullptr)
{ {

View file

@ -30,7 +30,13 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VFileProperty::VFileProperty(const QString& name) 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
{ {
} }

View file

@ -36,12 +36,21 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VLabelProperty::VLabelProperty(const QString &name, const QMap<QString, QVariant> &settings) VPE::VLabelProperty::VLabelProperty(const QString &name, const QMap<QString, QVariant> &settings)
: VProperty(name, QVariant::String), : VProperty(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMetaType::QString),
#else
QVariant::String),
#endif
typeForParent(0) typeForParent(0)
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
VPE::VLabelProperty::VLabelProperty(const QString &name) VPE::VLabelProperty::VLabelProperty(const QString &name)
@ -49,7 +58,11 @@ VPE::VLabelProperty::VLabelProperty(const QString &name)
typeForParent(0) typeForParent(0)
{ {
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
QWidget *VPE::VLabelProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VLabelProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,

View file

@ -40,10 +40,20 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VLineColorProperty::VLineColorProperty(const QString &name) 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
} }
QVariant VPE::VLineColorProperty::data(int column, int role) const 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
if (VProperty::d_ptr->editor != nullptr) if (VProperty::d_ptr->editor != nullptr)
{ {

View file

@ -37,10 +37,20 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VLineTypeProperty::VLineTypeProperty(const QString &name) 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
} }
QVariant VPE::VLineTypeProperty::data(int column, int role) const 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
if (VProperty::d_ptr->editor != nullptr) if (VProperty::d_ptr->editor != nullptr)
{ {

View file

@ -45,21 +45,34 @@ const int VPE::VIntegerProperty::StandardMin = -1000000;
const int VPE::VIntegerProperty::StandardMax = 1000000; const int VPE::VIntegerProperty::StandardMax = 1000000;
VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings) VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& 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_minValue(StandardMin),
m_maxValue(StandardMax), m_maxValue(StandardMax),
m_singleStep(1.0) m_singleStep(1.0)
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
VProperty::d_ptr->VariantValue.setValue(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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
} }
VPE::VIntegerProperty::VIntegerProperty(const QString &name) VPE::VIntegerProperty::VIntegerProperty(const QString &name)
: VProperty(name), m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0) : VProperty(name), m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0)
{ {
VProperty::d_ptr->VariantValue.setValue(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); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
#endif
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! 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; const double VPE::VDoubleProperty::StandardPrecision = 5;
VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings) VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& 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_minValue(StandardMin),
m_maxValue(StandardMax), m_maxValue(StandardMax),
m_singleStep(1.0), m_singleStep(1.0),
@ -174,7 +193,11 @@ VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, Q
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
VProperty::d_ptr->VariantValue.setValue(0); VProperty::d_ptr->VariantValue.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); VProperty::d_ptr->VariantValue.convert(QVariant::Double);
#endif
} }
VPE::VDoubleProperty::VDoubleProperty(const QString &name) VPE::VDoubleProperty::VDoubleProperty(const QString &name)
@ -185,8 +208,13 @@ VPE::VDoubleProperty::VDoubleProperty(const QString &name)
m_precision(static_cast<int>(StandardPrecision)) m_precision(static_cast<int>(StandardPrecision))
{ {
VProperty::d_ptr->VariantValue.setValue(0); 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->VariantValue.convert(QVariant::Double);
VProperty::d_ptr->PropertyVariantType = QVariant::Double; VProperty::d_ptr->PropertyVariantType = QVariant::Double;
#endif
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one

View file

@ -28,10 +28,20 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VObjectProperty::VObjectProperty(const QString& name) 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; 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); VProperty::d_ptr->VariantValue.convert(QVariant::UInt);
#endif
} }
//! Get the data how it should be displayed //! Get the data how it should be displayed
@ -130,7 +140,11 @@ QMap<QString, quint32> VPE::VObjectProperty::getObjects() const
void VPE::VObjectProperty::setValue(const QVariant& value) void VPE::VObjectProperty::setValue(const QVariant& value)
{ {
VProperty::d_ptr->VariantValue = 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); VProperty::d_ptr->VariantValue.convert(QVariant::UInt);
#endif
if (VProperty::d_ptr->editor != nullptr) if (VProperty::d_ptr->editor != nullptr)
{ {

View file

@ -28,10 +28,19 @@
#include "vnumberproperty.h" #include "vnumberproperty.h"
VPE::VPointFProperty::VPointFProperty(const QString &name) 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); 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); d_ptr->VariantValue.convert(QVariant::PointF);
#endif
VDoubleProperty* tmpX = new VDoubleProperty("X"); VDoubleProperty* tmpX = new VDoubleProperty("X");
addChild(tmpX); addChild(tmpX);
@ -92,10 +101,18 @@ void VPE::VPointFProperty::setPointF(qreal x, qreal y)
} }
QVariant tmpX(x); QVariant tmpX(x);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
tmpX.convert(QMetaType(QMetaType::Double));
#else
tmpX.convert(QVariant::Double); tmpX.convert(QVariant::Double);
#endif
QVariant tmpY(y); QVariant tmpY(y);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
tmpY.convert(QMetaType(QMetaType::Double));
#else
tmpY.convert(QVariant::Double); tmpY.convert(QVariant::Double);
#endif
d_ptr->Children.at(0)->setValue(tmpX); d_ptr->Children.at(0)->setValue(tmpX);
d_ptr->Children.at(1)->setValue(tmpY); d_ptr->Children.at(1)->setValue(tmpY);

View file

@ -29,7 +29,12 @@
#include "vshortcutpropertyeditor.h" #include "vshortcutpropertyeditor.h"
VPE::VShortcutProperty::VShortcutProperty(const QString& name) 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
{ {
} }

View file

@ -30,18 +30,32 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
VPE::VStringProperty::VStringProperty(const QString &name, const QMap<QString, QVariant> &settings) VPE::VStringProperty::VStringProperty(const QString &name, const QMap<QString, QVariant> &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); VProperty::setSettings(settings);
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
VPE::VStringProperty::VStringProperty(const QString &name) VPE::VStringProperty::VStringProperty(const QString &name)
: VProperty(name), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false) : VProperty(name), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false)
{ {
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,

View file

@ -50,12 +50,21 @@ void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar)
VPE::VTextProperty::VTextProperty(const QString &name, const QMap<QString, QVariant> &settings) VPE::VTextProperty::VTextProperty(const QString &name, const QMap<QString, QVariant> &settings)
: VProperty(name, QVariant::String), : VProperty(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMetaType::QString),
#else
QVariant::String),
#endif
readOnly(false) readOnly(false)
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
VPE::VTextProperty::VTextProperty(const QString &name) VPE::VTextProperty::VTextProperty(const QString &name)
@ -63,7 +72,11 @@ VPE::VTextProperty::VTextProperty(const QString &name)
readOnly(false) readOnly(false)
{ {
d_ptr->VariantValue.setValue(QString()); 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); d_ptr->VariantValue.convert(QVariant::String);
#endif
} }
QWidget *VPE::VTextProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VTextProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,

View file

@ -29,7 +29,14 @@
#include "../vproperty.h" #include "../vproperty.h"
VPE::VWidgetProperty::VWidgetProperty(const QString& name, QWidget* widget) 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))
{ {
} }

View file

@ -39,7 +39,13 @@ public:
//! Constructor passing name and type //! 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) {} : VPropertyPrivate(name, type), FileFilters(), Directory(directory) {}
//! Constructor //! Constructor

View file

@ -33,7 +33,12 @@
#include "vproperty_p.h" #include "vproperty_p.h"
//! Standard constructor, takes a name and a parent property as argument //! 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)) : QObject(), d_ptr(new VPropertyPrivate(name, type))
{ {
@ -114,7 +119,11 @@ QWidget* VPE::VProperty::createEditor(QWidget * parent, const QStyleOptionViewIt
QItemEditorFactory *factory = new QItemEditorFactory; QItemEditorFactory *factory = new QItemEditorFactory;
QItemEditorCreatorBase *lineCreator = new QStandardItemEditorCreator<QLineEdit>(); QItemEditorCreatorBase *lineCreator = new QStandardItemEditorCreator<QLineEdit>();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
factory->registerEditor(QMetaType::QString, lineCreator);
#else
factory->registerEditor(QVariant::String, lineCreator); factory->registerEditor(QVariant::String, lineCreator);
#endif
QItemEditorFactory::setDefaultFactory(factory); QItemEditorFactory::setDefaultFactory(factory);
d_ptr->editor = factory->createEditor(static_cast<int>(d_ptr->PropertyVariantType), parent); d_ptr->editor = factory->createEditor(static_cast<int>(d_ptr->PropertyVariantType), parent);
@ -178,7 +187,11 @@ Qt::ItemFlags VPE::VProperty::flags(int column) const
void VPE::VProperty::setValue(const QVariant &value) void VPE::VProperty::setValue(const QVariant &value)
{ {
d_ptr->VariantValue = 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<int>(d_ptr->PropertyVariantType)); d_ptr->VariantValue.convert(static_cast<int>(d_ptr->PropertyVariantType));
#endif
if (d_ptr->editor != nullptr) if (d_ptr->editor != nullptr)
{ {
setEditorData(d_ptr->editor); setEditorData(d_ptr->editor);

View file

@ -42,6 +42,8 @@
#include <ciso646> #include <ciso646>
#include "vpropertydef.h"
template <typename T> class QList; template <typename T> class QList;
namespace VPE namespace VPE
@ -75,7 +77,12 @@ public:
}; };
//! Standard constructor, takes a name and a parent property as argument //! 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 //! Destructor
virtual ~VProperty() override; virtual ~VProperty() override;

View file

@ -44,7 +44,13 @@ public:
QPointer<QWidget> Widget; QPointer<QWidget> Widget;
//! Constructor passing name and type //! 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) {} : VPropertyPrivate(name, type), Widget(widget) {}
//! Constructor //! Constructor