version 2.0.0_alpha

Important! All QtWraps macros renamed!
Qt 6 support
Graphic export feature
qad_types cross-Qt small changes
This commit is contained in:
2021-03-05 13:05:23 +03:00
parent add26cf9ad
commit 7b011ed242
46 changed files with 815 additions and 219 deletions

View File

@@ -210,99 +210,167 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
return;
}
_delete();
#if QT_VERSION_MAJOR <= 5
switch (new_value.type()) {
#else
switch (new_value.metaType().id()) {
#endif
#if QT_VERSION_MAJOR <= 5
case QVariant::Bool:
#else
case QMetaType::Bool:
#endif
_check = new QCheckBox(this);
_check->setAutoFillBackground(true);
_cur_edit = _check;
connect(_check, SIGNAL(toggled(bool)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Int:
#else
case QMetaType::Int:
#endif
_spin = new QDoubleSpinBox(this);
_spin->setDecimals(0);
_spin->setRange(-0x7FFFFFFF, 0x7FFFFFFF);
_cur_edit = _spin;
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::UInt:
#else
case QMetaType::UInt:
#endif
_spin = new QDoubleSpinBox(this);
_spin->setDecimals(0);
_spin->setRange(0, 0xFFFFFFFF);
_cur_edit = _spin;
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::LongLong:
#else
case QMetaType::LongLong:
#endif
_spin = new QDoubleSpinBox(this);
_spin->setDecimals(0);
_spin->setRange(-0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFFL);
_cur_edit = _spin;
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::ULongLong:
#else
case QMetaType::ULongLong:
#endif
_spin = new QDoubleSpinBox(this);
_spin->setDecimals(0);
_spin->setRange(0L, 0x7FFFFFFFFFFFFFFFL);
_cur_edit = _spin;
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Double:
#else
case QMetaType::Double:
#endif
_espin = new EvalSpinBox(this);
//_spin->setDecimals(5);
//_spin->setRange(-1E+199, 1E+199);
_cur_edit = _espin;
connect(_espin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Color:
#else
case QMetaType::QColor:
#endif
_color = new ColorButton(this);
_color->setUseAlphaChannel(true);
_cur_edit = _color;
connect(_color, SIGNAL(colorChanged(QColor)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::String:
#else
case QMetaType::QString:
#endif
_line = new CLineEdit(this);
_cur_edit = _line;
connect(_line, SIGNAL(textChanged(QString)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::StringList:
#else
case QMetaType::QStringList:
#endif
_list = new StringListEdit(this);
_cur_edit = _list;
connect(_list, SIGNAL(valueChanged()), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Rect:
#else
case QMetaType::QRect:
#endif
_rect = new QRectEdit(this);
_rect->setDecimals(0);
_cur_edit = _rect;
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::RectF:
#else
case QMetaType::QRectF:
#endif
_rect = new QRectEdit(this);
_rect->setDecimals(3);
_cur_edit = _rect;
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Point:
#else
case QMetaType::QPoint:
#endif
_point = new QPointEdit(this);
_point->setDecimals(0);
_cur_edit = _point;
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::PointF:
#else
case QMetaType::QPointF:
#endif
_point = new QPointEdit(this);
_point->setDecimals(3);
_cur_edit = _point;
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Date:
#else
case QMetaType::QDate:
#endif
_date = new QDateEdit(this);
_cur_edit = _date;
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::Time:
#else
case QMetaType::QTime:
#endif
_date = new QTimeEdit(this);
_cur_edit = _date;
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
break;
#if QT_VERSION_MAJOR <= 5
case QVariant::DateTime:
#else
case QMetaType::QDateTime:
#endif
_date = new QDateTimeEdit(this);
_cur_edit = _date;
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
@@ -351,23 +419,107 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
QVariant QVariantEdit::value() const {
#if QT_VERSION_MAJOR <= 5
switch (_value.type()) {
case QVariant::Bool: return _check->isChecked();
case QVariant::Int: return int(_spin->value());
case QVariant::UInt: return (unsigned int)(_spin->value());
case QVariant::LongLong: return qlonglong(_spin->value());
case QVariant::ULongLong: return qulonglong(_spin->value());
case QVariant::Double: return _espin->value();
case QVariant::Color: return _color->color();
case QVariant::String: return _line->text();
case QVariant::StringList: return _list->value();
case QVariant::Rect: return _rect->value().toRect();
case QVariant::RectF: return _rect->value();
case QVariant::Point: return _point->value().toPoint();
case QVariant::PointF: return _point->value();
case QVariant::Date: return _date->date();
case QVariant::Time: return _date->time();
case QVariant::DateTime: return _date->dateTime();
#else
switch (_value.metaType().id()) {
#endif
#if QT_VERSION_MAJOR <= 5
case QVariant::Bool:
#else
case QMetaType::Bool:
#endif
return _check->isChecked();
#if QT_VERSION_MAJOR <= 5
case QVariant::Int:
#else
case QMetaType::Int:
#endif
return int(_spin->value());
#if QT_VERSION_MAJOR <= 5
case QVariant::UInt:
#else
case QMetaType::UInt:
#endif
return (unsigned int)(_spin->value());
#if QT_VERSION_MAJOR <= 5
case QVariant::LongLong:
#else
case QMetaType::LongLong:
#endif
return qlonglong(_spin->value());
#if QT_VERSION_MAJOR <= 5
case QVariant::ULongLong:
#else
case QMetaType::ULongLong:
#endif
return qulonglong(_spin->value());
#if QT_VERSION_MAJOR <= 5
case QVariant::Double:
#else
case QMetaType::Double:
#endif
return _espin->value();
#if QT_VERSION_MAJOR <= 5
case QVariant::Color:
#else
case QMetaType::QColor:
#endif
return _color->color();
#if QT_VERSION_MAJOR <= 5
case QVariant::String:
#else
case QMetaType::QString:
#endif
return _line->text();
#if QT_VERSION_MAJOR <= 5
case QVariant::StringList:
#else
case QMetaType::QStringList:
#endif
return _list->value();
#if QT_VERSION_MAJOR <= 5
case QVariant::Rect:
#else
case QMetaType::QRect:
#endif
return _rect->value().toRect();
#if QT_VERSION_MAJOR <= 5
case QVariant::RectF:
#else
case QMetaType::QRectF:
#endif
return _rect->value();
#if QT_VERSION_MAJOR <= 5
case QVariant::Point:
#else
case QMetaType::QPoint:
#endif
return _point->value().toPoint();
#if QT_VERSION_MAJOR <= 5
case QVariant::PointF:
#else
case QMetaType::QPointF:
#endif
return _point->value();
#if QT_VERSION_MAJOR <= 5
case QVariant::Date:
#else
case QMetaType::QDate:
#endif
return _date->date();
#if QT_VERSION_MAJOR <= 5
case QVariant::Time:
#else
case QMetaType::QTime:
#endif
return _date->time();
#if QT_VERSION_MAJOR <= 5
case QVariant::DateTime:
#else
case QMetaType::QDateTime:
#endif
return _date->dateTime();
default:
if (_value.canConvert<QAD::Enum>() && _enum) {
QAD::Enum ret;