Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
a78d667431
commit
73d1476fb1
@ -134,7 +134,7 @@ static QVariant convertCborValue(const QCborValue &value)
|
||||
enum TrimFloatingPoint { Double, Float, Float16 };
|
||||
static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrimming)
|
||||
{
|
||||
if (v.userType() == QVariant::List) {
|
||||
if (v.userType() == QMetaType::QVariantList) {
|
||||
const QVariantList list = v.toList();
|
||||
QCborArray array;
|
||||
for (const QVariant &v : list)
|
||||
@ -152,7 +152,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
|
||||
return map;
|
||||
}
|
||||
|
||||
if (v.userType() == QVariant::Double && fpTrimming != Double) {
|
||||
if (v.userType() == QMetaType::Double && fpTrimming != Double) {
|
||||
float f = float(v.toDouble());
|
||||
if (fpTrimming == Float16)
|
||||
return float(qfloat16(f));
|
||||
|
@ -96,8 +96,8 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
|
||||
QString indented = indent + QLatin1String(" ");
|
||||
|
||||
int type = v.userType();
|
||||
if (type == qMetaTypeId<VariantOrderedMap>() || type == QVariant::Map) {
|
||||
const auto map = (type == QVariant::Map) ?
|
||||
if (type == qMetaTypeId<VariantOrderedMap>() || type == QMetaType::QVariantMap) {
|
||||
const auto map = (type == QMetaType::QVariantMap) ?
|
||||
VariantOrderedMap(v.toMap()) : qvariant_cast<VariantOrderedMap>(v);
|
||||
|
||||
result = QLatin1String("Map {");
|
||||
@ -109,7 +109,7 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
|
||||
}
|
||||
result.chop(1); // remove comma
|
||||
result += indent + QLatin1String("},");
|
||||
} else if (type == QVariant::List) {
|
||||
} else if (type == QMetaType::QVariantList) {
|
||||
const QVariantList list = v.toList();
|
||||
|
||||
result = QLatin1String("List [");
|
||||
|
@ -56,21 +56,21 @@
|
||||
static void dumpVariant(QTextStream &out, const QVariant &v)
|
||||
{
|
||||
switch (v.userType()) {
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
const QVariantList list = v.toList();
|
||||
for (const QVariant &item : list)
|
||||
dumpVariant(out, item);
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
const QStringList list = v.toStringList();
|
||||
for (const QString &s : list)
|
||||
out << s << Qt::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::Map: {
|
||||
case QMetaType::QVariantMap: {
|
||||
const QVariantMap map = v.toMap();
|
||||
for (auto it = map.begin(); it != map.end(); ++it) {
|
||||
out << it.key() << " => ";
|
||||
|
@ -284,18 +284,18 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
|
||||
ba.resize(n);
|
||||
result = ba;
|
||||
} else {
|
||||
int id = QVariant::Invalid;
|
||||
int id = QMetaType::UnknownType;
|
||||
if (type == QLatin1String("datetime"))
|
||||
id = QVariant::DateTime;
|
||||
id = QMetaType::QDateTime;
|
||||
else if (type == QLatin1String("url"))
|
||||
id = QVariant::Url;
|
||||
id = QMetaType::QUrl;
|
||||
else if (type == QLatin1String("uuid"))
|
||||
id = QVariant::Uuid;
|
||||
id = QMetaType::QUuid;
|
||||
else if (type == QLatin1String("regex"))
|
||||
id = QVariant::RegularExpression;
|
||||
id = QMetaType::QRegularExpression;
|
||||
else
|
||||
id = QMetaType::type(type.toLatin1());
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
fprintf(stderr, "%lld:%lld: Invalid XML: unknown type '%s'.\n",
|
||||
xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString()));
|
||||
exit(EXIT_FAILURE);
|
||||
@ -327,14 +327,14 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
|
||||
static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
|
||||
{
|
||||
int type = v.userType();
|
||||
if (type == QVariant::List) {
|
||||
if (type == QMetaType::QVariantList) {
|
||||
QVariantList list = v.toList();
|
||||
xml.writeStartElement("list");
|
||||
for (const QVariant &v : list)
|
||||
variantToXml(xml, v);
|
||||
xml.writeEndElement();
|
||||
} else if (type == QVariant::Map || type == qMetaTypeId<VariantOrderedMap>()) {
|
||||
const VariantOrderedMap map = (type == QVariant::Map) ?
|
||||
} else if (type == QMetaType::QVariantMap || type == qMetaTypeId<VariantOrderedMap>()) {
|
||||
const VariantOrderedMap map = (type == QMetaType::QVariantMap) ?
|
||||
VariantOrderedMap(v.toMap()) :
|
||||
qvariant_cast<VariantOrderedMap>(v);
|
||||
|
||||
@ -433,7 +433,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
|
||||
// does this convert to string?
|
||||
const char *typeName = v.typeName();
|
||||
QVariant copy = v;
|
||||
if (copy.convert(QVariant::String)) {
|
||||
if (copy.convert(QMetaType::QString)) {
|
||||
xml.writeAttribute(typeString, QString::fromLatin1(typeName));
|
||||
xml.writeCharacters(copy.toString());
|
||||
} else {
|
||||
|
@ -209,7 +209,7 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
|
||||
// store it
|
||||
peers.clear();
|
||||
QVariant peerEntry = dict.value("peers");
|
||||
if (peerEntry.type() == QVariant::List) {
|
||||
if (peerEntry.userType() == QMetaType::QVariantList) {
|
||||
QList<QVariant> peerTmp = peerEntry.toList();
|
||||
for (int i = 0; i < peerTmp.size(); ++i) {
|
||||
TorrentPeer tmp;
|
||||
|
@ -61,7 +61,7 @@ Window::Window()
|
||||
QItemEditorCreatorBase *colorListCreator =
|
||||
new QStandardItemEditorCreator<ColorListEditor>();
|
||||
|
||||
factory->registerEditor(QVariant::Color, colorListCreator);
|
||||
factory->registerEditor(QMetaType::QColor, colorListCreator);
|
||||
|
||||
QItemEditorFactory::setDefaultFactory(factory);
|
||||
|
||||
|
@ -98,7 +98,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
|
||||
//! [4]
|
||||
|
||||
//! [6]
|
||||
if (leftData.type() == QVariant::DateTime) {
|
||||
if (leftData.userType() == QMetaType::QDateTime) {
|
||||
return leftData.toDateTime() < rightData.toDateTime();
|
||||
} else {
|
||||
static const QRegularExpression emailPattern("[\\w\\.]*@[\\w\\.]*");
|
||||
|
@ -208,7 +208,7 @@ void SettingsTree::updateChildItems(QTreeWidgetItem *parent)
|
||||
}
|
||||
|
||||
QVariant value = settings->value(key);
|
||||
if (value.type() == QVariant::Invalid) {
|
||||
if (value.userType() == QMetaType::UnknownType) {
|
||||
child->setText(1, "Invalid");
|
||||
} else {
|
||||
child->setText(1, value.typeName());
|
||||
|
@ -81,7 +81,7 @@ void VariantDelegate::paint(QPainter *painter,
|
||||
{
|
||||
if (index.column() == 2) {
|
||||
QVariant value = index.model()->data(index, Qt::UserRole);
|
||||
if (!isSupportedType(value.type())) {
|
||||
if (!isSupportedType(value.userType())) {
|
||||
QStyleOptionViewItem myOption = option;
|
||||
myOption.state &= ~QStyle::State_Enabled;
|
||||
QStyledItemDelegate::paint(painter, myOption, index);
|
||||
@ -100,7 +100,7 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
|
||||
return nullptr;
|
||||
|
||||
QVariant originalValue = index.model()->data(index, Qt::UserRole);
|
||||
if (!isSupportedType(originalValue.type()))
|
||||
if (!isSupportedType(originalValue.userType()))
|
||||
return nullptr;
|
||||
|
||||
QLineEdit *lineEdit = new QLineEdit(parent);
|
||||
@ -108,46 +108,46 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
|
||||
|
||||
QRegularExpression regExp;
|
||||
|
||||
switch (originalValue.type()) {
|
||||
case QVariant::Bool:
|
||||
switch (originalValue.userType()) {
|
||||
case QMetaType::Bool:
|
||||
regExp = boolExp;
|
||||
break;
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
regExp = byteArrayExp;
|
||||
break;
|
||||
case QVariant::Char:
|
||||
case QMetaType::QChar:
|
||||
regExp = charExp;
|
||||
break;
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
regExp = colorExp;
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
regExp = dateExp;
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
regExp = dateTimeExp;
|
||||
break;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
regExp = doubleExp;
|
||||
break;
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
regExp = signedIntegerExp;
|
||||
break;
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
regExp = pointExp;
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
regExp = rectExp;
|
||||
break;
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
regExp = sizeExp;
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
regExp = timeExp;
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
regExp = unsignedIntegerExp;
|
||||
break;
|
||||
default:
|
||||
@ -189,18 +189,18 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
QVariant value;
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
switch (originalValue.type()) {
|
||||
case QVariant::Char:
|
||||
switch (originalValue.userType()) {
|
||||
case QMetaType::QChar:
|
||||
value = text.at(0);
|
||||
break;
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
match = colorExp.match(text);
|
||||
value = QColor(qMin(match.captured(1).toInt(), 255),
|
||||
qMin(match.captured(2).toInt(), 255),
|
||||
qMin(match.captured(3).toInt(), 255),
|
||||
qMin(match.captured(4).toInt(), 255));
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
{
|
||||
QDate date = QDate::fromString(text, Qt::ISODate);
|
||||
if (!date.isValid())
|
||||
@ -208,7 +208,7 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
value = date;
|
||||
}
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
{
|
||||
QDateTime dateTime = QDateTime::fromString(text, Qt::ISODate);
|
||||
if (!dateTime.isValid())
|
||||
@ -216,23 +216,23 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
value = dateTime;
|
||||
}
|
||||
break;
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
match = pointExp.match(text);
|
||||
value = QPoint(match.captured(1).toInt(), match.captured(2).toInt());
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
match = rectExp.match(text);
|
||||
value = QRect(match.captured(1).toInt(), match.captured(2).toInt(),
|
||||
match.captured(3).toInt(), match.captured(4).toInt());
|
||||
break;
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
match = sizeExp.match(text);
|
||||
value = QSize(match.captured(1).toInt(), match.captured(2).toInt());
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
value = text.split(',');
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
{
|
||||
QTime time = QTime::fromString(text, Qt::ISODate);
|
||||
if (!time.isValid())
|
||||
@ -242,33 +242,33 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
break;
|
||||
default:
|
||||
value = text;
|
||||
value.convert(originalValue.type());
|
||||
value.convert(originalValue.userType());
|
||||
}
|
||||
|
||||
model->setData(index, displayText(value), Qt::DisplayRole);
|
||||
model->setData(index, value, Qt::UserRole);
|
||||
}
|
||||
|
||||
bool VariantDelegate::isSupportedType(QVariant::Type type)
|
||||
bool VariantDelegate::isSupportedType(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Char:
|
||||
case QVariant::Color:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::Point:
|
||||
case QVariant::Rect:
|
||||
case QVariant::Size:
|
||||
case QVariant::String:
|
||||
case QVariant::StringList:
|
||||
case QVariant::Time:
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::QColor:
|
||||
case QMetaType::QDate:
|
||||
case QMetaType::QDateTime:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::QPoint:
|
||||
case QMetaType::QRect:
|
||||
case QMetaType::QSize:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::QStringList:
|
||||
case QMetaType::QTime:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -277,50 +277,50 @@ bool VariantDelegate::isSupportedType(QVariant::Type type)
|
||||
|
||||
QString VariantDelegate::displayText(const QVariant &value)
|
||||
{
|
||||
switch (value.type()) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Char:
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::String:
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
switch (value.userType()) {
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
return value.toString();
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
{
|
||||
QColor color = qvariant_cast<QColor>(value);
|
||||
return QString("(%1,%2,%3,%4)")
|
||||
.arg(color.red()).arg(color.green())
|
||||
.arg(color.blue()).arg(color.alpha());
|
||||
}
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return value.toDate().toString(Qt::ISODate);
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return value.toDateTime().toString(Qt::ISODate);
|
||||
case QVariant::Invalid:
|
||||
case QMetaType::UnknownType:
|
||||
return "<Invalid>";
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
{
|
||||
QPoint point = value.toPoint();
|
||||
return QString("(%1,%2)").arg(point.x()).arg(point.y());
|
||||
}
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
{
|
||||
QRect rect = value.toRect();
|
||||
return QString("(%1,%2,%3,%4)")
|
||||
.arg(rect.x()).arg(rect.y())
|
||||
.arg(rect.width()).arg(rect.height());
|
||||
}
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
{
|
||||
QSize size = value.toSize();
|
||||
return QString("(%1,%2)").arg(size.width()).arg(size.height());
|
||||
}
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return value.toStringList().join(',');
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return value.toTime().toString(Qt::ISODate);
|
||||
default:
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
static bool isSupportedType(QVariant::Type type);
|
||||
static bool isSupportedType(int type);
|
||||
static QString displayText(const QVariant &value);
|
||||
|
||||
private:
|
||||
|
@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
|
||||
void QPropertyAnimationPrivate::updateMetaProperty()
|
||||
{
|
||||
if (!target || propertyName.isEmpty()) {
|
||||
propertyType = QVariant::Invalid;
|
||||
propertyType = QMetaType::UnknownType;
|
||||
propertyIndex = -1;
|
||||
return;
|
||||
}
|
||||
@ -102,11 +102,11 @@ void QPropertyAnimationPrivate::updateMetaProperty()
|
||||
propertyType = targetValue->property(propertyName).userType();
|
||||
propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName);
|
||||
|
||||
if (propertyType != QVariant::Invalid)
|
||||
if (propertyType != QMetaType::UnknownType)
|
||||
convertValues(propertyType);
|
||||
if (propertyIndex == -1) {
|
||||
//there is no Q_PROPERTY on the object
|
||||
propertyType = QVariant::Invalid;
|
||||
propertyType = QMetaType::UnknownType;
|
||||
if (!targetValue->dynamicPropertyNames().contains(propertyName))
|
||||
qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
|
||||
} else if (!targetValue->metaObject()->property(propertyIndex).isWritable()) {
|
||||
|
@ -396,12 +396,12 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
{
|
||||
QString result;
|
||||
|
||||
switch (v.type()) {
|
||||
case QVariant::Invalid:
|
||||
switch (v.userType()) {
|
||||
case QMetaType::UnknownType:
|
||||
result = QLatin1String("@Invalid()");
|
||||
break;
|
||||
|
||||
case QVariant::ByteArray: {
|
||||
case QMetaType::QByteArray: {
|
||||
QByteArray a = v.toByteArray();
|
||||
result = QLatin1String("@ByteArray(")
|
||||
+ QLatin1String(a.constData(), a.size())
|
||||
@ -409,14 +409,14 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::String:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
case QVariant::Bool:
|
||||
case QVariant::Double:
|
||||
case QVariant::KeySequence: {
|
||||
case QMetaType::QString:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::QKeySequence: {
|
||||
result = v.toString();
|
||||
if (result.contains(QChar::Null))
|
||||
result = QLatin1String("@String(") + result + QLatin1Char(')');
|
||||
@ -425,17 +425,17 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
break;
|
||||
}
|
||||
#ifndef QT_NO_GEOM_VARIANT
|
||||
case QVariant::Rect: {
|
||||
case QMetaType::QRect: {
|
||||
QRect r = qvariant_cast<QRect>(v);
|
||||
result = QString::asprintf("@Rect(%d %d %d %d)", r.x(), r.y(), r.width(), r.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Size: {
|
||||
case QMetaType::QSize: {
|
||||
QSize s = qvariant_cast<QSize>(v);
|
||||
result = QString::asprintf("@Size(%d %d)", s.width(), s.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Point: {
|
||||
case QMetaType::QPoint: {
|
||||
QPoint p = qvariant_cast<QPoint>(v);
|
||||
result = QString::asprintf("@Point(%d %d)", p.x(), p.y());
|
||||
break;
|
||||
@ -446,7 +446,7 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
QDataStream::Version version;
|
||||
const char *typeSpec;
|
||||
if (v.type() == QVariant::DateTime) {
|
||||
if (v.userType() == QMetaType::QDateTime) {
|
||||
version = QDataStream::Qt_5_6;
|
||||
typeSpec = "@DateTime(";
|
||||
} else {
|
||||
@ -1888,8 +1888,8 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti
|
||||
QVariant(QString("foo")).toList() returns an empty
|
||||
list, not a list containing "foo".
|
||||
*/
|
||||
if (value.type() == QVariant::StringList
|
||||
|| (value.type() == QVariant::List && value.toList().size() != 1)) {
|
||||
if (value.userType() == QMetaType::QStringList
|
||||
|| (value.userType() == QMetaType::QVariantList && value.toList().size() != 1)) {
|
||||
iniEscapedStringList(variantListToStringList(value.toList()), block, iniCodec);
|
||||
} else {
|
||||
iniEscapedString(variantToString(value), block, iniCodec);
|
||||
|
@ -552,32 +552,32 @@ const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()
|
||||
bool QAbstractItemModelPrivate::isVariantLessThan(const QVariant &left, const QVariant &right,
|
||||
Qt::CaseSensitivity cs, bool isLocaleAware)
|
||||
{
|
||||
if (left.userType() == QVariant::Invalid)
|
||||
if (left.userType() == QMetaType::UnknownType)
|
||||
return false;
|
||||
if (right.userType() == QVariant::Invalid)
|
||||
if (right.userType() == QMetaType::UnknownType)
|
||||
return true;
|
||||
switch (left.userType()) {
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
return left.toInt() < right.toInt();
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return left.toUInt() < right.toUInt();
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return left.toLongLong() < right.toLongLong();
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return left.toULongLong() < right.toULongLong();
|
||||
case QMetaType::Float:
|
||||
return left.toFloat() < right.toFloat();
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return left.toDouble() < right.toDouble();
|
||||
case QVariant::Char:
|
||||
case QMetaType::QChar:
|
||||
return left.toChar() < right.toChar();
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return left.toDate() < right.toDate();
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return left.toTime() < right.toTime();
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return left.toDateTime() < right.toDateTime();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default:
|
||||
if (isLocaleAware)
|
||||
return left.toString().localeAwareCompare(right.toString()) < 0;
|
||||
@ -591,19 +591,19 @@ static uint typeOfVariant(const QVariant &value)
|
||||
{
|
||||
//return 0 for integer, 1 for floating point and 2 for other
|
||||
switch (value.userType()) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::Char:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::Short:
|
||||
case QMetaType::UShort:
|
||||
case QMetaType::UChar:
|
||||
case QMetaType::ULong:
|
||||
case QMetaType::Long:
|
||||
return 0;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Float:
|
||||
return 1;
|
||||
default:
|
||||
@ -2379,7 +2379,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||
} else { // QString or regular expression based matching
|
||||
if (matchType == Qt::MatchRegularExpression) {
|
||||
if (rx.pattern().isEmpty()) {
|
||||
if (value.type() == QVariant::RegularExpression) {
|
||||
if (value.userType() == QMetaType::QRegularExpression) {
|
||||
rx = value.toRegularExpression();
|
||||
} else {
|
||||
rx.setPattern(value.toString());
|
||||
|
@ -2982,7 +2982,7 @@ int QMetaProperty::userType() const
|
||||
if (type == QMetaType::UnknownType) {
|
||||
type = registerPropertyType();
|
||||
if (type == QMetaType::UnknownType)
|
||||
return QVariant::Int; // Match behavior of QMetaType::type()
|
||||
return QMetaType::Int; // Match behavior of QMetaType::type()
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@ -3100,7 +3100,7 @@ QVariant QMetaProperty::read(const QObject *object) const
|
||||
if (!object || !mobj)
|
||||
return QVariant();
|
||||
|
||||
uint t = QVariant::Int;
|
||||
uint t = QMetaType::Int;
|
||||
if (isEnumType()) {
|
||||
/*
|
||||
try to create a QVariant that can be converted to this enum
|
||||
@ -3177,9 +3177,9 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
|
||||
return false;
|
||||
|
||||
QVariant v = value;
|
||||
uint t = QVariant::Invalid;
|
||||
uint t = QMetaType::UnknownType;
|
||||
if (isEnumType()) {
|
||||
if (v.type() == QVariant::String) {
|
||||
if (v.userType() == QMetaType::QString) {
|
||||
bool ok;
|
||||
if (isFlagType())
|
||||
v = QVariant(menum.keysToValue(value.toByteArray(), &ok));
|
||||
@ -3187,13 +3187,13 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
|
||||
v = QVariant(menum.keyToValue(value.toByteArray(), &ok));
|
||||
if (!ok)
|
||||
return false;
|
||||
} else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) {
|
||||
} else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) {
|
||||
int enumMetaTypeId = QMetaType::type(qualifiedName(menum));
|
||||
if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData())
|
||||
return false;
|
||||
v = QVariant(*reinterpret_cast<const int *>(v.constData()));
|
||||
}
|
||||
v.convert(QVariant::Int);
|
||||
v.convert(QMetaType::Int);
|
||||
} else {
|
||||
int handle = priv(mobj->d.data)->propertyData + 3*idx;
|
||||
const char *typeName = nullptr;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void setData(const QString &format, const QVariant &data);
|
||||
QVariant getData(const QString &format) const;
|
||||
|
||||
QVariant retrieveTypedData(const QString &format, QVariant::Type type) const;
|
||||
QVariant retrieveTypedData(const QString &format, QMetaType::Type type) const;
|
||||
|
||||
QVector<QMimeDataStruct> dataList;
|
||||
};
|
||||
@ -108,23 +108,23 @@ QVariant QMimeDataPrivate::getData(const QString &format) const
|
||||
return data;
|
||||
}
|
||||
|
||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Type type) const
|
||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const
|
||||
{
|
||||
Q_Q(const QMimeData);
|
||||
|
||||
QVariant data = q->retrieveData(format, type);
|
||||
QVariant data = q->retrieveData(format, QVariant::Type(type));
|
||||
|
||||
// Text data requested: fallback to URL data if available
|
||||
if (format == QLatin1String("text/plain") && !data.isValid()) {
|
||||
data = retrieveTypedData(textUriListLiteral(), QVariant::List);
|
||||
if (data.type() == QVariant::Url) {
|
||||
data = retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList);
|
||||
if (data.userType() == QMetaType::QUrl) {
|
||||
data = QVariant(data.toUrl().toDisplayString());
|
||||
} else if (data.type() == QVariant::List) {
|
||||
} else if (data.userType() == QMetaType::QVariantList) {
|
||||
QString text;
|
||||
int numUrls = 0;
|
||||
const QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url) {
|
||||
if (list.at(i).userType() == QMetaType::QUrl) {
|
||||
text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n');
|
||||
++numUrls;
|
||||
}
|
||||
@ -135,26 +135,26 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type() == type || !data.isValid())
|
||||
if (data.userType() == type || !data.isValid())
|
||||
return data;
|
||||
|
||||
// provide more conversion possiblities than just what QVariant provides
|
||||
|
||||
// URLs can be lists as well...
|
||||
if ((type == QVariant::Url && data.type() == QVariant::List)
|
||||
|| (type == QVariant::List && data.type() == QVariant::Url))
|
||||
if ((type == QMetaType::QUrl && data.userType() == QMetaType::QVariantList)
|
||||
|| (type == QMetaType::QVariantList && data.userType() == QMetaType::QUrl))
|
||||
return data;
|
||||
|
||||
// images and pixmaps are interchangeable
|
||||
if ((type == QVariant::Pixmap && data.type() == QVariant::Image)
|
||||
|| (type == QVariant::Image && data.type() == QVariant::Pixmap))
|
||||
if ((type == QMetaType::QPixmap && data.userType() == QMetaType::QImage)
|
||||
|| (type == QMetaType::QImage && data.userType() == QMetaType::QPixmap))
|
||||
return data;
|
||||
|
||||
if (data.type() == QVariant::ByteArray) {
|
||||
if (data.userType() == QMetaType::QByteArray) {
|
||||
// see if we can convert to the requested type
|
||||
switch(type) {
|
||||
#if QT_CONFIG(textcodec)
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
const QByteArray ba = data.toByteArray();
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
if (format == QLatin1String("text/html"))
|
||||
@ -162,17 +162,17 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
return codec->toUnicode(ba);
|
||||
}
|
||||
#endif // textcodec
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
QVariant newData = data;
|
||||
newData.convert(QVariant::Color);
|
||||
newData.convert(QMetaType::QColor);
|
||||
return newData;
|
||||
}
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
if (format != QLatin1String("text/uri-list"))
|
||||
break;
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QVariant::Url: {
|
||||
case QMetaType::QUrl: {
|
||||
QByteArray ba = data.toByteArray();
|
||||
// Qt 3.x will send text/uri-list with a trailing
|
||||
// null-terminator (that is *not* sent for any other
|
||||
@ -193,23 +193,23 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (type == QVariant::ByteArray) {
|
||||
} else if (type == QMetaType::QByteArray) {
|
||||
|
||||
// try to convert to bytearray
|
||||
switch(data.type()) {
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Color:
|
||||
switch (data.userType()) {
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QColor:
|
||||
return data.toByteArray();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return data.toString().toUtf8();
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return data.toUrl().toEncoded();
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
// has to be list of URLs
|
||||
QByteArray result;
|
||||
QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url) {
|
||||
if (list.at(i).userType() == QMetaType::QUrl) {
|
||||
result += list.at(i).toUrl().toEncoded();
|
||||
result += "\r\n";
|
||||
}
|
||||
@ -340,14 +340,14 @@ QMimeData::~QMimeData()
|
||||
QList<QUrl> QMimeData::urls() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(textUriListLiteral(), QVariant::List);
|
||||
QVariant data = d->retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList);
|
||||
QList<QUrl> urls;
|
||||
if (data.type() == QVariant::Url)
|
||||
if (data.userType() == QMetaType::QUrl)
|
||||
urls.append(data.toUrl());
|
||||
else if (data.type() == QVariant::List) {
|
||||
else if (data.userType() == QMetaType::QVariantList) {
|
||||
QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url)
|
||||
if (list.at(i).userType() == QMetaType::QUrl)
|
||||
urls.append(list.at(i).toUrl());
|
||||
}
|
||||
}
|
||||
@ -400,11 +400,11 @@ bool QMimeData::hasUrls() const
|
||||
QString QMimeData::text() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QVariant::String);
|
||||
QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QMetaType::QString);
|
||||
if (!utf8Text.isNull())
|
||||
return utf8Text.toString();
|
||||
|
||||
QVariant data = d->retrieveTypedData(textPlainLiteral(), QVariant::String);
|
||||
QVariant data = d->retrieveTypedData(textPlainLiteral(), QMetaType::QString);
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ bool QMimeData::hasText() const
|
||||
QString QMimeData::html() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(textHtmlLiteral(), QVariant::String);
|
||||
QVariant data = d->retrieveTypedData(textHtmlLiteral(), QMetaType::QString);
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ bool QMimeData::hasHtml() const
|
||||
QVariant QMimeData::imageData() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
return d->retrieveTypedData(applicationXQtImageLiteral(), QVariant::Image);
|
||||
return d->retrieveTypedData(applicationXQtImageLiteral(), QMetaType::QImage);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -529,7 +529,7 @@ bool QMimeData::hasImage() const
|
||||
QVariant QMimeData::colorData() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
return d->retrieveTypedData(applicationXColorLiteral(), QVariant::Color);
|
||||
return d->retrieveTypedData(applicationXColorLiteral(), QMetaType::QColor);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -564,7 +564,7 @@ bool QMimeData::hasColor() const
|
||||
QByteArray QMimeData::data(const QString &mimeType) const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(mimeType, QVariant::ByteArray);
|
||||
QVariant data = d->retrieveTypedData(mimeType, QMetaType::QByteArray);
|
||||
return data.toByteArray();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -362,7 +362,7 @@ class QVariantConstructor
|
||||
FilteredConstructor(const QVariantConstructor &tc)
|
||||
{
|
||||
// ignore types that lives outside of the current library
|
||||
tc.m_x->type = QVariant::Invalid;
|
||||
tc.m_x->type = QMetaType::UnknownType;
|
||||
}
|
||||
};
|
||||
public:
|
||||
@ -430,7 +430,7 @@ public:
|
||||
{}
|
||||
~QVariantDestructor()
|
||||
{
|
||||
m_d->type = QVariant::Invalid;
|
||||
m_d->type = QMetaType::UnknownType;
|
||||
m_d->is_null = true;
|
||||
m_d->is_shared = false;
|
||||
}
|
||||
|
@ -640,9 +640,9 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
|
||||
// Handle strings and byte arrays directly, to avoid creating a temporary
|
||||
// dummy container to hold their data.
|
||||
int type = variant.userType();
|
||||
if (type == QVariant::String) {
|
||||
if (type == QMetaType::QString) {
|
||||
d->append(variant.toString());
|
||||
} else if (type == QVariant::ByteArray) {
|
||||
} else if (type == QMetaType::QByteArray) {
|
||||
QByteArray ba = variant.toByteArray();
|
||||
d->appendByteData(ba.constData(), ba.size(), QCborValue::ByteArray);
|
||||
} else {
|
||||
@ -703,45 +703,45 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
|
||||
QCborValue QCborValue::fromVariant(const QVariant &variant)
|
||||
{
|
||||
switch (variant.userType()) {
|
||||
case QVariant::Invalid:
|
||||
case QMetaType::UnknownType:
|
||||
return {};
|
||||
case QMetaType::Nullptr:
|
||||
return nullptr;
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return variant.toBool();
|
||||
case QMetaType::Short:
|
||||
case QMetaType::UShort:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::UInt:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
return variant.toLongLong();
|
||||
case QMetaType::Float:
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return variant.toDouble();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return variant.toString();
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return QCborArray::fromStringList(variant.toStringList());
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
return variant.toByteArray();
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return QCborValue(variant.toDateTime());
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return QCborValue(variant.toUrl());
|
||||
#endif
|
||||
case QVariant::Uuid:
|
||||
case QMetaType::QUuid:
|
||||
return QCborValue(variant.toUuid());
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
return QCborArray::fromVariantList(variant.toList());
|
||||
case QVariant::Map:
|
||||
case QMetaType::QVariantMap:
|
||||
return QCborMap::fromVariantMap(variant.toMap());
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
return QCborMap::fromVariantHash(variant.toHash());
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_CONFIG(regularexpression)
|
||||
case QVariant::RegularExpression:
|
||||
case QMetaType::QRegularExpression:
|
||||
return QCborValue(variant.toRegularExpression());
|
||||
#endif
|
||||
case QMetaType::QJsonValue:
|
||||
|
@ -405,17 +405,17 @@ QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)
|
||||
{
|
||||
QJsonDocument doc;
|
||||
|
||||
switch (variant.type()) {
|
||||
case QVariant::Map:
|
||||
switch (variant.userType()) {
|
||||
case QMetaType::QVariantMap:
|
||||
doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
break;
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
doc.setObject(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
break;
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
doc.setArray(QJsonArray::fromVariantList(variant.toList()));
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
doc.d = qt_make_unique<QJsonDocumentPrivate>();
|
||||
doc.d->value = QCborArray::fromStringList(variant.toStringList());
|
||||
break;
|
||||
|
@ -447,29 +447,29 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant)
|
||||
switch (variant.userType()) {
|
||||
case QMetaType::Nullptr:
|
||||
return QJsonValue(Null);
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return QJsonValue(variant.toBool());
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::Float:
|
||||
case QVariant::Double:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::UInt:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
return QJsonValue(variant.toDouble());
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return QJsonValue(variant.toString());
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return QJsonValue(QJsonArray::fromStringList(variant.toStringList()));
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
return QJsonValue(QJsonArray::fromVariantList(variant.toList()));
|
||||
case QVariant::Map:
|
||||
case QMetaType::QVariantMap:
|
||||
return QJsonValue(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
return QJsonValue(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return QJsonValue(variant.toUrl().toString(QUrl::FullyEncoded));
|
||||
case QVariant::Uuid:
|
||||
case QMetaType::QUuid:
|
||||
return variant.toUuid().toString(QUuid::WithoutBraces);
|
||||
case QMetaType::QJsonValue:
|
||||
return variant.toJsonValue();
|
||||
|
@ -2430,7 +2430,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca
|
||||
{
|
||||
QTime time;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, nullptr, &time);
|
||||
@ -2469,7 +2469,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca
|
||||
{
|
||||
QDate date;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, &date, nullptr);
|
||||
@ -2510,7 +2510,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal
|
||||
QTime time;
|
||||
QDate date;
|
||||
|
||||
QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
||||
return QDateTime(date, time);
|
||||
|
@ -234,16 +234,16 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
||||
case CurrencySymbol:
|
||||
return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt()));
|
||||
case CurrencyToString: {
|
||||
switch (in.type()) {
|
||||
case QVariant::Int:
|
||||
switch (in.userType()) {
|
||||
case QMetaType::Int:
|
||||
return lc_monetary.toCurrencyString(in.toInt());
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return lc_monetary.toCurrencyString(in.toUInt());
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return lc_monetary.toCurrencyString(in.toDouble());
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return lc_monetary.toCurrencyString(in.toLongLong());
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return lc_monetary.toCurrencyString(in.toULongLong());
|
||||
default:
|
||||
break;
|
||||
|
@ -1791,7 +1791,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar
|
||||
{
|
||||
QDate date;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal);
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, &date, nullptr);
|
||||
@ -2537,7 +2537,7 @@ QTime QTime::fromString(const QString &string, const QString &format)
|
||||
{
|
||||
QTime time;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar());
|
||||
QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, QCalendar());
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, nullptr, &time);
|
||||
@ -5482,7 +5482,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format, QC
|
||||
QTime time;
|
||||
QDate date;
|
||||
|
||||
QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
||||
return QDateTime(date, time);
|
||||
|
@ -425,7 +425,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
switch (sect) {
|
||||
case 'H':
|
||||
case 'h':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const Section hour = (sect == 'h') ? Hour12Section : Hour24Section;
|
||||
const SectionNode sn = { hour, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
@ -436,7 +436,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { MinuteSection, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -446,7 +446,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { SecondSection, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -457,7 +457,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { MSecSection, i - add, countRepeat(newFormat, i, 3) < 3 ? 1 : 3, 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -468,7 +468,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
break;
|
||||
case 'A':
|
||||
case 'a':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const bool cap = (sect == 'A');
|
||||
const SectionNode sn = { AmPmSection, i - add, (cap ? 1 : 0), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
@ -482,7 +482,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const int repeat = countRepeat(newFormat, i, 4);
|
||||
if (repeat >= 2) {
|
||||
const SectionNode sn = { repeat == 4 ? YearSection : YearSection2Digits,
|
||||
@ -496,7 +496,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const SectionNode sn = { MonthSection, i - add, countRepeat(newFormat, i, 4), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
newSeparators.append(unquote(newFormat.midRef(index, i - index)));
|
||||
@ -506,7 +506,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const int repeat = countRepeat(newFormat, i, 4);
|
||||
const Section sectionType = (repeat == 4 ? DayOfWeekSectionLong
|
||||
: (repeat == 3 ? DayOfWeekSectionShort : DaySection));
|
||||
@ -519,7 +519,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const SectionNode sn = { TimeZoneSection, i - add, countRepeat(newFormat, i, 4), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -1252,7 +1252,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
return StateNode();
|
||||
}
|
||||
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
|
||||
if (!(isSet & YearSection)) {
|
||||
year = (year / 100) * 100;
|
||||
@ -1322,7 +1322,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
}
|
||||
}
|
||||
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
if (isSet & Hour12Section) {
|
||||
const bool hasHour = isSet & Hour24Section;
|
||||
if (ampm == -1) {
|
||||
@ -1360,7 +1360,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
|
||||
// If hour wasn't specified, check the default we're using exists on the
|
||||
// given date (which might be a spring-forward, skipping an hour).
|
||||
if (parserType == QVariant::DateTime && !(isSet & HourSectionMask) && !when.isValid()) {
|
||||
if (parserType == QMetaType::QDateTime && !(isSet & HourSectionMask) && !when.isValid()) {
|
||||
qint64 msecs = when.toMSecsSinceEpoch();
|
||||
// Fortunately, that gets a useful answer, even though when is invalid ...
|
||||
const QDateTime replace =
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
FromString,
|
||||
DateTimeEdit
|
||||
};
|
||||
QDateTimeParser(QVariant::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
||||
QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
||||
: currentSectionIndex(-1), cachedDay(-1), parserType(t),
|
||||
fixday(false), spec(Qt::LocalTime), context(ctx), calendar(cal)
|
||||
{
|
||||
@ -295,7 +295,7 @@ protected: // for the benefit of QDateTimeEditPrivate
|
||||
QStringList separators;
|
||||
QString displayFormat;
|
||||
QLocale defaultLocale;
|
||||
QVariant::Type parserType;
|
||||
QMetaType::Type parserType;
|
||||
bool fixday;
|
||||
Qt::TimeSpec spec; // spec if used by QDateTimeEdit
|
||||
Context context;
|
||||
|
@ -157,7 +157,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
|
||||
const int type = mp.userType();
|
||||
// is this metatype registered?
|
||||
const char *expectedSignature = "";
|
||||
if (int(mp.type()) != QMetaType::QVariant) {
|
||||
if (int(mp.userType()) != QMetaType::QVariant) {
|
||||
expectedSignature = QDBusMetaType::typeToSignature(type);
|
||||
if (expectedSignature == nullptr) {
|
||||
qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be "
|
||||
|
@ -330,7 +330,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QMap<Key, T> &m
|
||||
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
|
||||
{
|
||||
arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
|
||||
arg.beginMap(QMetaType::QString, qMetaTypeId<QDBusVariant>());
|
||||
QVariantMap::ConstIterator it = map.constBegin();
|
||||
QVariantMap::ConstIterator end = map.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
@ -379,7 +379,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash<Key, T> &
|
||||
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map)
|
||||
{
|
||||
arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
|
||||
arg.beginMap(QMetaType::QString, qMetaTypeId<QDBusVariant>());
|
||||
QVariantHash::ConstIterator it = map.constBegin();
|
||||
QVariantHash::ConstIterator end = map.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
|
@ -1822,7 +1822,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
|
||||
hook.service = QDBusUtil::dbusService();
|
||||
hook.path.clear(); // no matching
|
||||
hook.obj = this;
|
||||
hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void
|
||||
hook.params << QMetaType::Void << QMetaType::QString; // both functions take a QString as parameter and return void
|
||||
|
||||
hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)");
|
||||
Q_ASSERT(hook.midx != -1);
|
||||
@ -1836,7 +1836,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
|
||||
// we don't use connectSignal here because the rules are added by connectSignal on a per-need basis
|
||||
hook.params.clear();
|
||||
hook.params.reserve(4);
|
||||
hook.params << QMetaType::Void << QVariant::String << QVariant::String << QVariant::String;
|
||||
hook.params << QMetaType::Void << QMetaType::QString << QMetaType::QString << QMetaType::QString;
|
||||
hook.midx = staticMetaObject.indexOfSlot("serviceOwnerChangedNoLock(QString,QString,QString)");
|
||||
Q_ASSERT(hook.midx != -1);
|
||||
signalHooks.insert(QLatin1String("NameOwnerChanged:" DBUS_INTERFACE_DBUS), hook);
|
||||
|
@ -55,7 +55,7 @@ static void copyArgument(void *to, int id, const QVariant &arg)
|
||||
{
|
||||
if (id == arg.userType()) {
|
||||
switch (id) {
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
*reinterpret_cast<bool *>(to) = arg.toBool();
|
||||
return;
|
||||
|
||||
@ -71,35 +71,35 @@ static void copyArgument(void *to, int id, const QVariant &arg)
|
||||
*reinterpret_cast<ushort *>(to) = qvariant_cast<ushort>(arg);
|
||||
return;
|
||||
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
*reinterpret_cast<int *>(to) = arg.toInt();
|
||||
return;
|
||||
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
*reinterpret_cast<uint *>(to) = arg.toUInt();
|
||||
return;
|
||||
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
*reinterpret_cast<qlonglong *>(to) = arg.toLongLong();
|
||||
return;
|
||||
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
*reinterpret_cast<qulonglong *>(to) = arg.toULongLong();
|
||||
return;
|
||||
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
*reinterpret_cast<double *>(to) = arg.toDouble();
|
||||
return;
|
||||
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
*reinterpret_cast<QString *>(to) = arg.toString();
|
||||
return;
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
*reinterpret_cast<QByteArray *>(to) = arg.toByteArray();
|
||||
return;
|
||||
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
*reinterpret_cast<QStringList *>(to) = arg.toStringList();
|
||||
return;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
|
||||
|
||||
const QVariant &value = arg.variant();
|
||||
int id = value.userType();
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
|
||||
error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
|
||||
return false;
|
||||
@ -384,7 +384,7 @@ void QDBusMarshaller::error(const QString &msg)
|
||||
bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
{
|
||||
int id = arg.userType();
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
qWarning("QDBusMarshaller: cannot add an invalid QVariant");
|
||||
error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
|
||||
return false;
|
||||
@ -485,12 +485,12 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
case DBUS_TYPE_ARRAY:
|
||||
// could be many things
|
||||
// find out what kind of array it is
|
||||
switch (arg.type()) {
|
||||
case QVariant::StringList:
|
||||
switch (arg.userType()) {
|
||||
case QMetaType::QStringList:
|
||||
append( arg.toStringList() );
|
||||
return true;
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
append( arg.toByteArray() );
|
||||
return true;
|
||||
|
||||
|
@ -276,7 +276,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn,
|
||||
for ( ; it != end; ++it) {
|
||||
int id = it->userType();
|
||||
const char *signature = QDBusMetaType::typeToSignature(id);
|
||||
if ((id != QVariant::StringList && id != QVariant::ByteArray &&
|
||||
if ((id != QMetaType::QStringList && id != QMetaType::QByteArray &&
|
||||
qstrlen(signature) != 1) || id == qMetaTypeId<QDBusVariant>()) {
|
||||
// yes, we are
|
||||
// we must marshall and demarshall again so as to create QDBusArgument
|
||||
|
@ -158,10 +158,10 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
const char *direction, int id)
|
||||
{
|
||||
Type result;
|
||||
result.id = QVariant::Invalid;
|
||||
result.id = QMetaType::UnknownType;
|
||||
|
||||
int type = QDBusMetaType::signatureToType(signature);
|
||||
if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) {
|
||||
if (type == QMetaType::UnknownType && !qt_dbus_metaobject_skip_annotations) {
|
||||
// it's not a type normally handled by our meta type system
|
||||
// it must contain an annotation
|
||||
QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
|
||||
@ -189,7 +189,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
type = QMetaType::type(typeName);
|
||||
}
|
||||
|
||||
if (type == QVariant::Invalid || signature != QDBusMetaType::typeToSignature(type)) {
|
||||
if (type == QMetaType::UnknownType || signature != QDBusMetaType::typeToSignature(type)) {
|
||||
// type is still unknown or doesn't match back to the signature that it
|
||||
// was expected to, so synthesize a fake type
|
||||
typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
|
||||
@ -197,16 +197,16 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
}
|
||||
|
||||
result.name = typeName;
|
||||
} else if (type == QVariant::Invalid) {
|
||||
} else if (type == QMetaType::UnknownType) {
|
||||
// this case is used only by the qdbus command-line tool
|
||||
// invalid, let's create an impossible type that contains the signature
|
||||
|
||||
if (signature == "av") {
|
||||
result.name = "QVariantList";
|
||||
type = QVariant::List;
|
||||
type = QMetaType::QVariantList;
|
||||
} else if (signature == "a{sv}") {
|
||||
result.name = "QVariantMap";
|
||||
type = QVariant::Map;
|
||||
type = QMetaType::QVariantMap;
|
||||
} else if (signature == "a{ss}") {
|
||||
result.name = "QMap<QString,QString>";
|
||||
type = qMetaTypeId<QMap<QString, QString> >();
|
||||
@ -246,7 +246,7 @@ void QDBusMetaObjectGenerator::parseMethods()
|
||||
const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -265,7 +265,7 @@ void QDBusMetaObjectGenerator::parseMethods()
|
||||
const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -322,7 +322,7 @@ void QDBusMetaObjectGenerator::parseSignals()
|
||||
const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -358,7 +358,7 @@ void QDBusMetaObjectGenerator::parseProperties()
|
||||
const QDBusIntrospection::Property &p = *prop_it;
|
||||
Property mp;
|
||||
Type type = findType(p.type.toLatin1(), p.annotations);
|
||||
if (type.id == QVariant::Invalid)
|
||||
if (type.id == QMetaType::UnknownType)
|
||||
continue;
|
||||
|
||||
QByteArray name = p.name.toLatin1();
|
||||
|
@ -325,7 +325,7 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
switch (signature[0])
|
||||
{
|
||||
case DBUS_TYPE_BOOLEAN:
|
||||
return QVariant::Bool;
|
||||
return QMetaType::Bool;
|
||||
|
||||
case DBUS_TYPE_BYTE:
|
||||
return QMetaType::UChar;
|
||||
@ -337,22 +337,22 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
return QMetaType::UShort;
|
||||
|
||||
case DBUS_TYPE_INT32:
|
||||
return QVariant::Int;
|
||||
return QMetaType::Int;
|
||||
|
||||
case DBUS_TYPE_UINT32:
|
||||
return QVariant::UInt;
|
||||
return QMetaType::UInt;
|
||||
|
||||
case DBUS_TYPE_INT64:
|
||||
return QVariant::LongLong;
|
||||
return QMetaType::LongLong;
|
||||
|
||||
case DBUS_TYPE_UINT64:
|
||||
return QVariant::ULongLong;
|
||||
return QMetaType::ULongLong;
|
||||
|
||||
case DBUS_TYPE_DOUBLE:
|
||||
return QVariant::Double;
|
||||
return QMetaType::Double;
|
||||
|
||||
case DBUS_TYPE_STRING:
|
||||
return QVariant::String;
|
||||
return QMetaType::QString;
|
||||
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
return QDBusMetaTypeId::objectpath();
|
||||
@ -369,13 +369,13 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
case DBUS_TYPE_ARRAY: // special case
|
||||
switch (signature[1]) {
|
||||
case DBUS_TYPE_BYTE:
|
||||
return QVariant::ByteArray;
|
||||
return QMetaType::QByteArray;
|
||||
|
||||
case DBUS_TYPE_STRING:
|
||||
return QVariant::StringList;
|
||||
return QMetaType::QStringList;
|
||||
|
||||
case DBUS_TYPE_VARIANT:
|
||||
return QVariant::List;
|
||||
return QMetaType::QVariantList;
|
||||
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
return qMetaTypeId<QList<QDBusObjectPath> >();
|
||||
@ -409,7 +409,7 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||
case QMetaType::UChar:
|
||||
return DBUS_TYPE_BYTE_AS_STRING;
|
||||
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return DBUS_TYPE_BOOLEAN_AS_STRING;
|
||||
|
||||
case QMetaType::Short:
|
||||
@ -418,29 +418,29 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||
case QMetaType::UShort:
|
||||
return DBUS_TYPE_UINT16_AS_STRING;
|
||||
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
return DBUS_TYPE_INT32_AS_STRING;
|
||||
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return DBUS_TYPE_UINT32_AS_STRING;
|
||||
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return DBUS_TYPE_INT64_AS_STRING;
|
||||
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return DBUS_TYPE_UINT64_AS_STRING;
|
||||
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return DBUS_TYPE_DOUBLE_AS_STRING;
|
||||
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return DBUS_TYPE_STRING_AS_STRING;
|
||||
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return DBUS_TYPE_ARRAY_AS_STRING
|
||||
DBUS_TYPE_STRING_AS_STRING; // as
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
return DBUS_TYPE_ARRAY_AS_STRING
|
||||
DBUS_TYPE_BYTE_AS_STRING; // ay
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
{
|
||||
int argType = arg.userType();
|
||||
|
||||
if (argType == QVariant::StringList) {
|
||||
if (argType == QMetaType::QStringList) {
|
||||
out += QLatin1Char('{');
|
||||
const QStringList list = arg.toStringList();
|
||||
for (const QString &item : list)
|
||||
@ -90,7 +90,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!list.isEmpty())
|
||||
out.chop(2);
|
||||
out += QLatin1Char('}');
|
||||
} else if (argType == QVariant::ByteArray) {
|
||||
} else if (argType == QMetaType::QByteArray) {
|
||||
out += QLatin1Char('{');
|
||||
QByteArray list = arg.toByteArray();
|
||||
for (int i = 0; i < list.count(); ++i) {
|
||||
@ -100,7 +100,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!list.isEmpty())
|
||||
out.chop(2);
|
||||
out += QLatin1Char('}');
|
||||
} else if (argType == QVariant::List) {
|
||||
} else if (argType == QMetaType::QVariantList) {
|
||||
out += QLatin1Char('{');
|
||||
const QList<QVariant> list = arg.toList();
|
||||
for (const QVariant &item : list) {
|
||||
@ -148,7 +148,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!variantToString(v, out))
|
||||
return false;
|
||||
out += QLatin1Char(']');
|
||||
} else if (arg.canConvert(QVariant::String)) {
|
||||
} else if (arg.canConvert(QMetaType::QString)) {
|
||||
out += QLatin1Char('\"') + arg.toString() + QLatin1Char('\"');
|
||||
} else {
|
||||
out += QLatin1Char('[');
|
||||
|
@ -113,7 +113,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
QLatin1String(signature),
|
||||
accessAsString(mp.isReadable(), mp.isWritable()));
|
||||
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
const char *typeName = QMetaType::typeName(typeId);
|
||||
retval += QLatin1String(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
|
||||
.arg(typeNameToXml(typeName));
|
||||
@ -161,7 +161,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
.arg(typeNameToXml(typeName));
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
|
||||
if (QDBusMetaType::signatureToType(typeName) == QMetaType::UnknownType)
|
||||
xml += QLatin1String(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
|
||||
.arg(typeNameToXml(QMetaType::typeName(typeId)));
|
||||
} else {
|
||||
@ -208,7 +208,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
qUtf16Printable(name), signature, isOutput ? "out" : "in");
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
const char *typeName = QMetaType::typeName(types.at(j));
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n")
|
||||
.arg(isOutput ? QLatin1String("Out") : QLatin1String("In"))
|
||||
|
@ -218,7 +218,7 @@ QBitmap::~QBitmap()
|
||||
*/
|
||||
QBitmap::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Bitmap, this);
|
||||
return QVariant(QMetaType::QBitmap, this);
|
||||
}
|
||||
|
||||
static QBitmap makeBitmap(QImage &&image, Qt::ImageConversionFlags flags)
|
||||
|
@ -782,7 +782,7 @@ QIcon &QIcon::operator=(const QIcon &other)
|
||||
*/
|
||||
QIcon::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Icon, this);
|
||||
return QVariant(QMetaType::QIcon, this);
|
||||
}
|
||||
|
||||
/*! \fn int QIcon::serialNumber() const
|
||||
|
@ -1067,7 +1067,7 @@ int QImage::devType() const
|
||||
*/
|
||||
QImage::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Image, this);
|
||||
return QVariant(QMetaType::QImage, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -402,7 +402,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
|
||||
*/
|
||||
QPixmap::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Pixmap, this);
|
||||
return QVariant(QMetaType::QPixmap, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -926,7 +926,7 @@ void QStandardItem::setData(const QVariant &value, int role)
|
||||
for (it = d->values.begin(); it != d->values.end(); ++it) {
|
||||
if ((*it).role == role) {
|
||||
if (value.isValid()) {
|
||||
if ((*it).value.type() == value.type() && (*it).value == value)
|
||||
if ((*it).value.userType() == value.userType() && (*it).value == value)
|
||||
return;
|
||||
(*it).value = value;
|
||||
} else {
|
||||
|
@ -657,7 +657,7 @@ QCursor &QCursor::operator=(const QCursor &c)
|
||||
*/
|
||||
QCursor::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Cursor, this);
|
||||
return QVariant(QMetaType::QCursor, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -178,25 +178,25 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
void *result, bool *ok)
|
||||
{
|
||||
switch (t) {
|
||||
case QVariant::ByteArray:
|
||||
if (d->type == QVariant::Color) {
|
||||
case QMetaType::QByteArray:
|
||||
if (d->type == QMetaType::QColor) {
|
||||
const QColor *c = v_cast<QColor>(d);
|
||||
*static_cast<QByteArray *>(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
QString *str = static_cast<QString *>(result);
|
||||
switch (d->type) {
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case QVariant::KeySequence:
|
||||
case QMetaType::QKeySequence:
|
||||
*str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
|
||||
return true;
|
||||
#endif
|
||||
case QVariant::Font:
|
||||
case QMetaType::QFont:
|
||||
*str = v_cast<QFont>(d)->toString();
|
||||
return true;
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
const QColor *c = v_cast<QColor>(d);
|
||||
*str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb);
|
||||
return true;
|
||||
@ -206,85 +206,85 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QVariant::Pixmap:
|
||||
if (d->type == QVariant::Image) {
|
||||
case QMetaType::QPixmap:
|
||||
if (d->type == QMetaType::QImage) {
|
||||
*static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Bitmap) {
|
||||
} else if (d->type == QMetaType::QBitmap) {
|
||||
*static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d);
|
||||
return true;
|
||||
} else if (d->type == QVariant::Brush) {
|
||||
} else if (d->type == QMetaType::QBrush) {
|
||||
if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) {
|
||||
*static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QVariant::Image:
|
||||
if (d->type == QVariant::Pixmap) {
|
||||
case QMetaType::QImage:
|
||||
if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage();
|
||||
return true;
|
||||
} else if (d->type == QVariant::Bitmap) {
|
||||
} else if (d->type == QMetaType::QBitmap) {
|
||||
*static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::Bitmap:
|
||||
if (d->type == QVariant::Pixmap) {
|
||||
case QMetaType::QBitmap:
|
||||
if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d);
|
||||
return true;
|
||||
} else if (d->type == QVariant::Image) {
|
||||
} else if (d->type == QMetaType::QImage) {
|
||||
*static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case QVariant::Int:
|
||||
if (d->type == QVariant::KeySequence) {
|
||||
case QMetaType::Int:
|
||||
if (d->type == QMetaType::QKeySequence) {
|
||||
const QKeySequence &seq = *v_cast<QKeySequence>(d);
|
||||
*static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0];
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case QVariant::Font:
|
||||
if (d->type == QVariant::String) {
|
||||
case QMetaType::QFont:
|
||||
if (d->type == QMetaType::QString) {
|
||||
QFont *f = static_cast<QFont *>(result);
|
||||
f->fromString(*v_cast<QString>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::Color:
|
||||
if (d->type == QVariant::String) {
|
||||
case QMetaType::QColor:
|
||||
if (d->type == QMetaType::QString) {
|
||||
static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
|
||||
return static_cast<QColor *>(result)->isValid();
|
||||
} else if (d->type == QVariant::ByteArray) {
|
||||
} else if (d->type == QMetaType::QByteArray) {
|
||||
static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Brush) {
|
||||
} else if (d->type == QMetaType::QBrush) {
|
||||
if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
|
||||
*static_cast<QColor *>(result) = v_cast<QBrush>(d)->color();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QVariant::Brush:
|
||||
if (d->type == QVariant::Color) {
|
||||
case QMetaType::QBrush:
|
||||
if (d->type == QMetaType::QColor) {
|
||||
*static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Pixmap) {
|
||||
} else if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case QVariant::KeySequence: {
|
||||
case QMetaType::QKeySequence: {
|
||||
QKeySequence *seq = static_cast<QKeySequence *>(result);
|
||||
switch (d->type) {
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
*seq = QKeySequence(*v_cast<QString>(d));
|
||||
return true;
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
*seq = QKeySequence(d->data.i);
|
||||
return true;
|
||||
default:
|
||||
@ -294,7 +294,7 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
}
|
||||
#endif
|
||||
#ifndef QT_NO_ICON
|
||||
case QVariant::Icon: {
|
||||
case QMetaType::QIcon: {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return false;
|
||||
|
@ -112,22 +112,23 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type
|
||||
{
|
||||
QVariant data = retrieveData_sys(mimeType, type);
|
||||
if (mimeType == QLatin1String("application/x-qt-image")) {
|
||||
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
|
||||
if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty())) {
|
||||
// try to find an image
|
||||
QStringList imageFormats = imageReadMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
data = retrieveData_sys(imageFormats.at(i), type);
|
||||
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
|
||||
if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty()))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int typeId = type;
|
||||
// we wanted some image type, but all we got was a byte array. Convert it to an image.
|
||||
if (data.type() == QVariant::ByteArray
|
||||
&& (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
|
||||
if (data.userType() == QMetaType::QByteArray
|
||||
&& (typeId == QMetaType::QImage || typeId == QMetaType::QPixmap || typeId == QMetaType::QBitmap))
|
||||
data = QImage::fromData(data.toByteArray());
|
||||
|
||||
} else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
|
||||
} else if (mimeType == QLatin1String("application/x-color") && data.userType() == QMetaType::QByteArray) {
|
||||
QColor c;
|
||||
QByteArray ba = data.toByteArray();
|
||||
if (ba.size() == 8) {
|
||||
@ -140,7 +141,7 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type
|
||||
} else {
|
||||
qWarning("Qt: Invalid color format");
|
||||
}
|
||||
} else if (data.type() != type && data.type() == QVariant::ByteArray) {
|
||||
} else if (data.userType() != int(type) && data.userType() == QMetaType::QByteArray) {
|
||||
// try to use mime data's internal conversion stuf.
|
||||
QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
|
||||
that->setData(mimeType, data.toByteArray());
|
||||
|
@ -1404,7 +1404,7 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
|
||||
*/
|
||||
QKeySequence::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::KeySequence, this);
|
||||
return QVariant(QMetaType::QKeySequence, this);
|
||||
}
|
||||
|
||||
/*! \fn QKeySequence::operator int () const
|
||||
|
@ -714,7 +714,7 @@ QPalette &QPalette::operator=(const QPalette &p)
|
||||
*/
|
||||
QPalette::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Palette, this);
|
||||
return QVariant(QMetaType::QPalette, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2007,7 +2007,7 @@ void QMatrix4x4::optimize()
|
||||
*/
|
||||
QMatrix4x4::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Matrix4x4, this);
|
||||
return QVariant(QMetaType::QMatrix4x4, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -983,7 +983,7 @@ QQuaternion QQuaternion::nlerp
|
||||
*/
|
||||
QQuaternion::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Quaternion, this);
|
||||
return QVariant(QMetaType::QQuaternion, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -531,7 +531,7 @@ QVector4D QVector2D::toVector4D() const
|
||||
*/
|
||||
QVector2D::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Vector2D, this);
|
||||
return QVariant(QMetaType::QVector2D, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -706,7 +706,7 @@ QVector4D QVector3D::toVector4D() const
|
||||
*/
|
||||
QVector3D::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Vector3D, this);
|
||||
return QVariant(QMetaType::QVector3D, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -608,7 +608,7 @@ QVector3D QVector4D::toVector3DAffine() const
|
||||
*/
|
||||
QVector4D::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Vector4D, this);
|
||||
return QVariant(QMetaType::QVector4D, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -672,7 +672,7 @@ QBrush &QBrush::operator=(const QBrush &b)
|
||||
*/
|
||||
QBrush::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Brush, this);
|
||||
return QVariant(QMetaType::QBrush, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2980,7 +2980,7 @@ bool QColor::operator!=(const QColor &color) const noexcept
|
||||
*/
|
||||
QColor::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Color, this);
|
||||
return QVariant(QMetaType::QColor, this);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
@ -1087,7 +1087,7 @@ QMatrix &QMatrix::operator=(const QMatrix &matrix) noexcept
|
||||
*/
|
||||
QMatrix::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Matrix, this);
|
||||
return QVariant(QMetaType::QMatrix, this);
|
||||
}
|
||||
|
||||
Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m)
|
||||
|
@ -408,7 +408,7 @@ QPen &QPen::operator=(const QPen &p) noexcept
|
||||
*/
|
||||
QPen::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Pen, this);
|
||||
return QVariant(QMetaType::QPen, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -716,7 +716,7 @@ QPolygon QPolygonF::toPolygon() const
|
||||
*/
|
||||
QPolygon::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Polygon, this);
|
||||
return QVariant(QMetaType::QPolygon, this);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -599,7 +599,7 @@ QRegion& QRegion::operator^=(const QRegion &r)
|
||||
*/
|
||||
QRegion::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Region, this);
|
||||
return QVariant(QMetaType::QRegion, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2155,7 +2155,7 @@ QTransform::TransformationType QTransform::type() const
|
||||
*/
|
||||
QTransform::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Transform, this);
|
||||
return QVariant(QMetaType::QTransform, this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -707,7 +707,7 @@ static Qt::Alignment parseAlignment(const QCss::Value *values, int count)
|
||||
static ColorData parseColorValue(QCss::Value v)
|
||||
{
|
||||
if (v.type == Value::Identifier || v.type == Value::String) {
|
||||
v.variant.convert(QVariant::Color);
|
||||
v.variant.convert(QMetaType::QColor);
|
||||
v.type = Value::Color;
|
||||
}
|
||||
|
||||
@ -1143,7 +1143,7 @@ static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAd
|
||||
} else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
|
||||
s.chop(2);
|
||||
value.variant = s;
|
||||
if (value.variant.convert(QVariant::Int)) {
|
||||
if (value.variant.convert(QMetaType::Int)) {
|
||||
font->setPixelSize(value.variant.toInt());
|
||||
valid = true;
|
||||
}
|
||||
@ -1420,9 +1420,9 @@ QColor Declaration::colorValue(const QPalette &pal) const
|
||||
return QColor();
|
||||
|
||||
if (d->parsed.isValid()) {
|
||||
if (d->parsed.type() == QVariant::Color)
|
||||
if (d->parsed.userType() == QMetaType::QColor)
|
||||
return qvariant_cast<QColor>(d->parsed);
|
||||
if (d->parsed.type() == QVariant::Int)
|
||||
if (d->parsed.userType() == QMetaType::Int)
|
||||
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
|
||||
}
|
||||
|
||||
@ -1442,9 +1442,9 @@ QBrush Declaration::brushValue(const QPalette &pal) const
|
||||
return QBrush();
|
||||
|
||||
if (d->parsed.isValid()) {
|
||||
if (d->parsed.type() == QVariant::Brush)
|
||||
if (d->parsed.userType() == QMetaType::QBrush)
|
||||
return qvariant_cast<QBrush>(d->parsed);
|
||||
if (d->parsed.type() == QVariant::Int)
|
||||
if (d->parsed.userType() == QMetaType::Int)
|
||||
return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
|
||||
}
|
||||
|
||||
@ -1469,9 +1469,9 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
|
||||
needParse = 0;
|
||||
QList<QVariant> v = d->parsed.toList();
|
||||
for (i = 0; i < qMin(v.count(), 4); i++) {
|
||||
if (v.at(i).type() == QVariant::Brush) {
|
||||
if (v.at(i).userType() == QMetaType::QBrush) {
|
||||
c[i] = qvariant_cast<QBrush>(v.at(i));
|
||||
} else if (v.at(i).type() == QVariant::Int) {
|
||||
} else if (v.at(i).userType() == QMetaType::Int) {
|
||||
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
|
||||
} else {
|
||||
needParse |= (1<<i);
|
||||
@ -1598,7 +1598,7 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
|
||||
if (d->parsed.isValid()) {
|
||||
QList<QVariant> v = d->parsed.toList();
|
||||
for (i = 0; i < qMin(d->values.count(), 4); i++) {
|
||||
if (v.at(i).type() == QVariant::Color) {
|
||||
if (v.at(i).userType() == QMetaType::QColor) {
|
||||
c[i] = qvariant_cast<QColor>(v.at(i));
|
||||
} else {
|
||||
c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
|
||||
@ -2723,7 +2723,7 @@ bool Parser::parseTerm(Value *value)
|
||||
switch (lookup()) {
|
||||
case NUMBER:
|
||||
value->type = Value::Number;
|
||||
value->variant.convert(QVariant::Double);
|
||||
value->variant.convert(QMetaType::Double);
|
||||
break;
|
||||
case PERCENTAGE:
|
||||
value->type = Value::Percentage;
|
||||
|
@ -1753,7 +1753,7 @@ bool QFont::operator!=(const QFont &f) const
|
||||
*/
|
||||
QFont::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Font, this);
|
||||
return QVariant(QMetaType::QFont, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -82,7 +82,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *
|
||||
|
||||
if (!fontName.isEmpty() && pixelSize) {
|
||||
QFont::Weight fontWeight = QFont::Normal;
|
||||
if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt)
|
||||
if (weight.userType() == QMetaType::Int || weight.userType() == QMetaType::UInt)
|
||||
fontWeight = QFont::Weight(weight.toInt());
|
||||
|
||||
QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt());
|
||||
|
@ -2234,7 +2234,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
|
||||
}
|
||||
|
||||
if (!r.isNull()) {
|
||||
if (type == ImageResource && r.type() == QVariant::ByteArray) {
|
||||
if (type == ImageResource && r.userType() == QMetaType::QByteArray) {
|
||||
if (qApp->thread() != QThread::currentThread()) {
|
||||
// must use images in non-GUI threads
|
||||
QImage image;
|
||||
@ -3049,12 +3049,12 @@ QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cach
|
||||
for (; it != priv->cachedResources.constEnd(); ++it) {
|
||||
|
||||
const QVariant &v = it.value();
|
||||
if (v.type() == QVariant::Image && !isPixmap) {
|
||||
if (v.userType() == QMetaType::QImage && !isPixmap) {
|
||||
if (qvariant_cast<QImage>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
|
||||
if (v.type() == QVariant::Pixmap && isPixmap) {
|
||||
if (v.userType() == QMetaType::QPixmap && isPixmap) {
|
||||
if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
if (v.isNull()) {
|
||||
return cellPadding;
|
||||
} else {
|
||||
Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float);
|
||||
Q_ASSERT(v.userType() == QMetaType::Double || v.userType() == QMetaType::Float);
|
||||
return QFixed::fromReal(v.toReal() * deviceScale);
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
QTextLength::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::TextLength, this);
|
||||
return QVariant(QMetaType::QTextLength, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
@ -288,20 +288,20 @@ static inline uint variantHash(const QVariant &variant)
|
||||
{
|
||||
// simple and fast hash functions to differentiate between type and value
|
||||
switch (variant.userType()) { // sorted by occurrence frequency
|
||||
case QVariant::String: return qHash(variant.toString());
|
||||
case QVariant::Double: return qHash(variant.toDouble());
|
||||
case QVariant::Int: return 0x811890 + variant.toInt();
|
||||
case QVariant::Brush:
|
||||
case QMetaType::QString: return qHash(variant.toString());
|
||||
case QMetaType::Double: return qHash(variant.toDouble());
|
||||
case QMetaType::Int: return 0x811890 + variant.toInt();
|
||||
case QMetaType::QBrush:
|
||||
return 0x01010101 + hash(qvariant_cast<QBrush>(variant));
|
||||
case QVariant::Bool: return 0x371818 + variant.toBool();
|
||||
case QVariant::Pen: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
|
||||
case QVariant::List:
|
||||
case QMetaType::Bool: return 0x371818 + variant.toBool();
|
||||
case QMetaType::QPen: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
|
||||
case QMetaType::QVariantList:
|
||||
return 0x8377 + qvariant_cast<QVariantList>(variant).count();
|
||||
case QVariant::Color: return hash(qvariant_cast<QColor>(variant));
|
||||
case QVariant::TextLength:
|
||||
case QMetaType::QColor: return hash(qvariant_cast<QColor>(variant));
|
||||
case QMetaType::QTextLength:
|
||||
return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
|
||||
case QMetaType::Float: return qHash(variant.toFloat());
|
||||
case QVariant::Invalid: return 0;
|
||||
case QMetaType::UnknownType: return 0;
|
||||
default: break;
|
||||
}
|
||||
return qHash(variant.typeName());
|
||||
@ -874,7 +874,7 @@ QTextFormat::~QTextFormat()
|
||||
*/
|
||||
QTextFormat::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::TextFormat, this);
|
||||
return QVariant(QMetaType::QTextFormat, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -984,7 +984,7 @@ bool QTextFormat::boolProperty(int propertyId) const
|
||||
if (!d)
|
||||
return false;
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Bool)
|
||||
if (prop.userType() != QMetaType::Bool)
|
||||
return false;
|
||||
return prop.toBool();
|
||||
}
|
||||
@ -1004,7 +1004,7 @@ int QTextFormat::intProperty(int propertyId) const
|
||||
if (!d)
|
||||
return def;
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Int)
|
||||
if (prop.userType() != QMetaType::Int)
|
||||
return def;
|
||||
return prop.toInt();
|
||||
}
|
||||
@ -1022,7 +1022,7 @@ qreal QTextFormat::doubleProperty(int propertyId) const
|
||||
if (!d)
|
||||
return 0.;
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float)
|
||||
if (prop.userType() != QMetaType::Double && prop.userType() != QMetaType::Float)
|
||||
return 0.;
|
||||
return qvariant_cast<qreal>(prop);
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ QString QTextFormat::stringProperty(int propertyId) const
|
||||
if (!d)
|
||||
return QString();
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::String)
|
||||
if (prop.userType() != QMetaType::QString)
|
||||
return QString();
|
||||
return prop.toString();
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ QColor QTextFormat::colorProperty(int propertyId) const
|
||||
if (!d)
|
||||
return QColor();
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Color)
|
||||
if (prop.userType() != QMetaType::QColor)
|
||||
return QColor();
|
||||
return qvariant_cast<QColor>(prop);
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ QPen QTextFormat::penProperty(int propertyId) const
|
||||
if (!d)
|
||||
return QPen(Qt::NoPen);
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Pen)
|
||||
if (prop.userType() != QMetaType::QPen)
|
||||
return QPen(Qt::NoPen);
|
||||
return qvariant_cast<QPen>(prop);
|
||||
}
|
||||
@ -1094,7 +1094,7 @@ QBrush QTextFormat::brushProperty(int propertyId) const
|
||||
if (!d)
|
||||
return QBrush(Qt::NoBrush);
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::Brush)
|
||||
if (prop.userType() != QMetaType::QBrush)
|
||||
return QBrush(Qt::NoBrush);
|
||||
return qvariant_cast<QBrush>(prop);
|
||||
}
|
||||
@ -1126,13 +1126,13 @@ QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
|
||||
if (!d)
|
||||
return vector;
|
||||
const QVariant prop = d->property(propertyId);
|
||||
if (prop.userType() != QVariant::List)
|
||||
if (prop.userType() != QMetaType::QVariantList)
|
||||
return vector;
|
||||
|
||||
QList<QVariant> propertyList = prop.toList();
|
||||
for (int i=0; i<propertyList.size(); ++i) {
|
||||
QVariant var = propertyList.at(i);
|
||||
if (var.userType() == QVariant::TextLength)
|
||||
if (var.userType() == QMetaType::QTextLength)
|
||||
vector.append(qvariant_cast<QTextLength>(var));
|
||||
}
|
||||
|
||||
@ -1222,7 +1222,7 @@ int QTextFormat::objectIndex() const
|
||||
if (!d)
|
||||
return -1;
|
||||
const QVariant prop = d->property(ObjectIndex);
|
||||
if (prop.userType() != QVariant::Int) // ####
|
||||
if (prop.userType() != QMetaType::Int) // ####
|
||||
return -1;
|
||||
return prop.toInt();
|
||||
}
|
||||
@ -1859,9 +1859,9 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
|
||||
QString QTextCharFormat::anchorName() const
|
||||
{
|
||||
QVariant prop = property(AnchorName);
|
||||
if (prop.userType() == QVariant::StringList)
|
||||
if (prop.userType() == QMetaType::QStringList)
|
||||
return prop.toStringList().value(0);
|
||||
else if (prop.userType() != QVariant::String)
|
||||
else if (prop.userType() != QMetaType::QString)
|
||||
return QString();
|
||||
return prop.toString();
|
||||
}
|
||||
@ -1878,9 +1878,9 @@ QString QTextCharFormat::anchorName() const
|
||||
QStringList QTextCharFormat::anchorNames() const
|
||||
{
|
||||
QVariant prop = property(AnchorName);
|
||||
if (prop.userType() == QVariant::StringList)
|
||||
if (prop.userType() == QMetaType::QStringList)
|
||||
return prop.toStringList();
|
||||
else if (prop.userType() != QVariant::String)
|
||||
else if (prop.userType() != QMetaType::QString)
|
||||
return QStringList();
|
||||
return QStringList(prop.toString());
|
||||
}
|
||||
|
@ -1451,19 +1451,19 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo
|
||||
|
||||
if (QCoreApplication::instance()->thread() != QThread::currentThread()) {
|
||||
// must use images in non-GUI threads
|
||||
if (val.type() == QVariant::Image) {
|
||||
if (val.userType() == QMetaType::QImage) {
|
||||
QImage image = qvariant_cast<QImage>(val);
|
||||
charFormat.setBackground(image);
|
||||
} else if (val.type() == QVariant::ByteArray) {
|
||||
} else if (val.userType() == QMetaType::QByteArray) {
|
||||
QImage image;
|
||||
if (image.loadFromData(val.toByteArray())) {
|
||||
charFormat.setBackground(image);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (val.type() == QVariant::Image || val.type() == QVariant::Pixmap) {
|
||||
if (val.userType() == QMetaType::QImage || val.userType() == QMetaType::QPixmap) {
|
||||
charFormat.setBackground(qvariant_cast<QPixmap>(val));
|
||||
} else if (val.type() == QVariant::ByteArray) {
|
||||
} else if (val.userType() == QMetaType::QByteArray) {
|
||||
QPixmap pm;
|
||||
if (pm.loadFromData(val.toByteArray())) {
|
||||
charFormat.setBackground(pm);
|
||||
@ -1907,9 +1907,9 @@ void QTextHtmlParser::importStyleSheet(const QString &href)
|
||||
|
||||
QVariant res = resourceProvider->resource(QTextDocument::StyleSheetResource, href);
|
||||
QString css;
|
||||
if (res.type() == QVariant::String) {
|
||||
if (res.userType() == QMetaType::QString) {
|
||||
css = res.toString();
|
||||
} else if (res.type() == QVariant::ByteArray) {
|
||||
} else if (res.userType() == QMetaType::QByteArray) {
|
||||
// #### detect @charset
|
||||
css = QString::fromUtf8(res.toByteArray());
|
||||
}
|
||||
|
@ -88,9 +88,9 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con
|
||||
qreal sourcePixelRatio = 1.0;
|
||||
name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
|
||||
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
|
||||
if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
|
||||
if (data.userType() == QMetaType::QPixmap || data.userType() == QMetaType::QImage) {
|
||||
pm = qvariant_cast<QPixmap>(data);
|
||||
} else if (data.type() == QVariant::ByteArray) {
|
||||
} else if (data.userType() == QMetaType::QByteArray) {
|
||||
pm.loadFromData(data.toByteArray());
|
||||
}
|
||||
|
||||
@ -170,9 +170,9 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const
|
||||
qreal sourcePixelRatio = 1.0;
|
||||
name = resolveFileName(name, &url, devicePixelRatio, &sourcePixelRatio);
|
||||
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
|
||||
if (data.type() == QVariant::Image) {
|
||||
if (data.userType() == QMetaType::QImage) {
|
||||
image = qvariant_cast<QImage>(data);
|
||||
} else if (data.type() == QVariant::ByteArray) {
|
||||
} else if (data.userType() == QMetaType::QByteArray) {
|
||||
image.loadFromData(data.toByteArray());
|
||||
}
|
||||
|
||||
|
@ -455,9 +455,9 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
|
||||
name.prepend(QLatin1String("qrc"));
|
||||
QUrl url = QUrl(name);
|
||||
const QVariant variant = m_document->resource(QTextDocument::ImageResource, url);
|
||||
if (variant.type() == QVariant::Image) {
|
||||
if (variant.userType() == QMetaType::QImage) {
|
||||
image = qvariant_cast<QImage>(variant);
|
||||
} else if (variant.type() == QVariant::ByteArray) {
|
||||
} else if (variant.userType() == QMetaType::QByteArray) {
|
||||
data = variant.toByteArray();
|
||||
|
||||
QBuffer buffer(&data);
|
||||
|
@ -93,7 +93,7 @@ bool performEffectiveAction(QAccessibleInterface *iface, const QString &actionNa
|
||||
if (!success)
|
||||
return false;
|
||||
stepSize = (max - min) / 10; // this is pretty arbitrary, we just need to provide something
|
||||
const int typ = currentVariant.type();
|
||||
const int typ = currentVariant.userType();
|
||||
if (typ != QMetaType::Float && typ != QMetaType::Double) {
|
||||
// currentValue is an integer. Round it up to ensure stepping in case it was below 1
|
||||
stepSize = qCeil(stepSize);
|
||||
|
@ -2250,7 +2250,7 @@ bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString
|
||||
qCDebug(lcAccessibilityAtspi) << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path();
|
||||
return false;
|
||||
}
|
||||
if (!value.canConvert(QVariant::Double)) {
|
||||
if (!value.canConvert(QMetaType::Double)) {
|
||||
qCDebug(lcAccessibilityAtspi) << "AtSpiAdaptor::valueInterface: Could not convert to double: " << function;
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue)
|
||||
// causing recursion.
|
||||
QString fontDescription;
|
||||
QString fontFamily;
|
||||
if (fontValue.type() == QVariant::StringList) {
|
||||
if (fontValue.userType() == QMetaType::QStringList) {
|
||||
const QStringList list = fontValue.toStringList();
|
||||
if (!list.isEmpty()) {
|
||||
fontFamily = list.first();
|
||||
|
@ -226,7 +226,7 @@ void QTuioHandler::process2DCurSource(const QOscMessage &message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) {
|
||||
if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::QByteArray) {
|
||||
qCWarning(lcTuioSource, "Ignoring malformed TUIO source message (bad argument type)");
|
||||
return;
|
||||
}
|
||||
@ -248,7 +248,7 @@ void QTuioHandler::process2DCurAlive(const QOscMessage &message)
|
||||
QMap<int, QTuioCursor> newActiveCursors;
|
||||
|
||||
for (int i = 1; i < arguments.count(); ++i) {
|
||||
if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) {
|
||||
if (QMetaType::Type(arguments.at(i).userType()) != QMetaType::Int) {
|
||||
qCWarning(lcTuioHandler) << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')';
|
||||
return;
|
||||
}
|
||||
@ -293,12 +293,12 @@ void QTuioHandler::process2DCurSet(const QOscMessage &message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(2).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(3).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(4).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(5).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(6).type()) != QMetaType::Float
|
||||
if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(2).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(3).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(4).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(5).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(6).userType()) != QMetaType::Float
|
||||
) {
|
||||
qCWarning(lcTuioSet) << "Ignoring malformed TUIO set message with bad types: " << arguments;
|
||||
return;
|
||||
@ -391,7 +391,7 @@ void QTuioHandler::process2DObjSource(const QOscMessage &message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) {
|
||||
if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::QByteArray) {
|
||||
qCWarning(lcTuioSource, "Ignoring malformed TUIO source message (bad argument type)");
|
||||
return;
|
||||
}
|
||||
@ -413,7 +413,7 @@ void QTuioHandler::process2DObjAlive(const QOscMessage &message)
|
||||
QMap<int, QTuioToken> newActiveTokens;
|
||||
|
||||
for (int i = 1; i < arguments.count(); ++i) {
|
||||
if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) {
|
||||
if (QMetaType::Type(arguments.at(i).userType()) != QMetaType::Int) {
|
||||
qCWarning(lcTuioHandler) << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')';
|
||||
return;
|
||||
}
|
||||
@ -458,16 +458,16 @@ void QTuioHandler::process2DObjSet(const QOscMessage &message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(2).type()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(3).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(4).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(5).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(6).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(7).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(8).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(9).type()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(10).type()) != QMetaType::Float) {
|
||||
if (QMetaType::Type(arguments.at(1).userType()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(2).userType()) != QMetaType::Int ||
|
||||
QMetaType::Type(arguments.at(3).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(4).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(5).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(6).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(7).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(8).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(9).userType()) != QMetaType::Float ||
|
||||
QMetaType::Type(arguments.at(10).userType()) != QMetaType::Float) {
|
||||
qCWarning(lcTuioSet) << "Ignoring malformed TUIO set message with bad types: " << arguments;
|
||||
return;
|
||||
}
|
||||
|
@ -123,8 +123,9 @@ protected:
|
||||
return list.contains(format);
|
||||
}
|
||||
|
||||
QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const override
|
||||
QVariant retrieveData_sys(const QString &fmt, QVariant::Type type) const override
|
||||
{
|
||||
auto requestedType = QMetaType::Type(type);
|
||||
if (fmt.isEmpty() || isEmpty())
|
||||
return QByteArray();
|
||||
|
||||
|
@ -114,7 +114,7 @@ protected:
|
||||
QStringList formats_sys() const override;
|
||||
QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
|
||||
|
||||
QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const;
|
||||
QVariant xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const;
|
||||
|
||||
QXcbDrag *drag;
|
||||
};
|
||||
@ -1248,11 +1248,11 @@ QXcbDropData::~QXcbDropData()
|
||||
QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const
|
||||
{
|
||||
QByteArray mime = mimetype.toLatin1();
|
||||
QVariant data = xdndObtainData(mime, requestedType);
|
||||
QVariant data = xdndObtainData(mime, QMetaType::Type(requestedType));
|
||||
return data;
|
||||
}
|
||||
|
||||
QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const
|
||||
QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QMetaType::Type requestedType) const
|
||||
{
|
||||
QByteArray result;
|
||||
|
||||
|
@ -159,7 +159,7 @@ QVector<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con
|
||||
}
|
||||
|
||||
QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &d, const QString &format,
|
||||
QVariant::Type requestedType, const QByteArray &encoding)
|
||||
QMetaType::Type requestedType, const QByteArray &encoding)
|
||||
{
|
||||
QByteArray data = d;
|
||||
QString atomName = mimeAtomToString(connection, a);
|
||||
@ -169,7 +169,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
|
||||
&& atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
|
||||
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (requestedType == QVariant::String) {
|
||||
if (requestedType == QMetaType::QString) {
|
||||
QTextCodec *codec = QTextCodec::codecForName(encoding);
|
||||
if (codec)
|
||||
return codec->toUnicode(data);
|
||||
@ -264,7 +264,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType,
|
||||
xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
|
||||
const QVector<xcb_atom_t> &atoms, QByteArray *requestedEncoding)
|
||||
{
|
||||
requestedEncoding->clear();
|
||||
@ -297,7 +297,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
|
||||
|
||||
// for string/text requests try to use a format with a well-defined charset
|
||||
// first to avoid encoding problems
|
||||
if (requestedType == QVariant::String
|
||||
if (requestedType == QMetaType::QString
|
||||
&& format.startsWith(QLatin1String("text/"))
|
||||
&& !format.contains(QLatin1String("charset="))) {
|
||||
|
||||
|
@ -60,8 +60,8 @@ public:
|
||||
static bool mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data,
|
||||
xcb_atom_t *atomFormat, int *dataFormat);
|
||||
static QVariant mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format,
|
||||
QVariant::Type requestedType, const QByteArray &encoding);
|
||||
static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType,
|
||||
QMetaType::Type requestedType, const QByteArray &encoding);
|
||||
static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QMetaType::Type requestedType,
|
||||
const QVector<xcb_atom_t> &atoms, QByteArray *requestedEncoding);
|
||||
};
|
||||
|
||||
|
@ -730,7 +730,7 @@ static char* createArrayBuffer(char *buffer, const QList<QVariant> &list,
|
||||
if (curDim != dim) {
|
||||
for(i = 0; i < list.size(); ++i) {
|
||||
|
||||
if (list.at(i).type() != QVariant::List) { // dimensions mismatch
|
||||
if (list.at(i).userType() != QVariant::List) { // dimensions mismatch
|
||||
error = QLatin1String("Array dimensons mismatch. Fieldname: %1");
|
||||
return 0;
|
||||
}
|
||||
@ -1162,7 +1162,7 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
|
||||
// null value
|
||||
QVariant v;
|
||||
v.convert(qIBaseTypeName2(d->sqlda->sqlvar[i].sqltype, d->sqlda->sqlvar[i].sqlscale < 0));
|
||||
if(v.type() == QVariant::Double) {
|
||||
if (v.userType() == QVariant::Double) {
|
||||
switch(numericalPrecisionPolicy()) {
|
||||
case QSql::LowPrecisionInt32:
|
||||
v.convert(QVariant::Int);
|
||||
|
@ -223,13 +223,13 @@ public:
|
||||
{
|
||||
QMyField()
|
||||
: outField(0), nullIndicator(false), bufLength(0ul),
|
||||
myField(0), type(QVariant::Invalid)
|
||||
myField(0), type(QMetaType::UnknownType)
|
||||
{}
|
||||
char *outField;
|
||||
my_bool nullIndicator;
|
||||
ulong bufLength;
|
||||
MYSQL_FIELD *myField;
|
||||
QVariant::Type type;
|
||||
QMetaType::Type type;
|
||||
};
|
||||
|
||||
QVector<QMyField> fields;
|
||||
@ -263,25 +263,25 @@ static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
|
||||
}
|
||||
|
||||
|
||||
static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags)
|
||||
static QMetaType::Type qDecodeMYSQLType(int mysqltype, uint flags)
|
||||
{
|
||||
QVariant::Type type;
|
||||
QMetaType::Type type;
|
||||
switch (mysqltype) {
|
||||
case FIELD_TYPE_TINY :
|
||||
type = static_cast<QVariant::Type>((flags & UNSIGNED_FLAG) ? QMetaType::UChar : QMetaType::Char);
|
||||
type = (flags & UNSIGNED_FLAG) ? QMetaType::UChar : QMetaType::Char;
|
||||
break;
|
||||
case FIELD_TYPE_SHORT :
|
||||
type = static_cast<QVariant::Type>((flags & UNSIGNED_FLAG) ? QMetaType::UShort : QMetaType::Short);
|
||||
type = (flags & UNSIGNED_FLAG) ? QMetaType::UShort : QMetaType::Short;
|
||||
break;
|
||||
case FIELD_TYPE_LONG :
|
||||
case FIELD_TYPE_INT24 :
|
||||
type = (flags & UNSIGNED_FLAG) ? QVariant::UInt : QVariant::Int;
|
||||
type = (flags & UNSIGNED_FLAG) ? QMetaType::UInt : QMetaType::Int;
|
||||
break;
|
||||
case FIELD_TYPE_YEAR :
|
||||
type = QVariant::Int;
|
||||
type = QMetaType::Int;
|
||||
break;
|
||||
case FIELD_TYPE_LONGLONG :
|
||||
type = (flags & UNSIGNED_FLAG) ? QVariant::ULongLong : QVariant::LongLong;
|
||||
type = (flags & UNSIGNED_FLAG) ? QMetaType::ULongLong : QMetaType::LongLong;
|
||||
break;
|
||||
case FIELD_TYPE_FLOAT :
|
||||
case FIELD_TYPE_DOUBLE :
|
||||
@ -289,19 +289,19 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags)
|
||||
#if defined(FIELD_TYPE_NEWDECIMAL)
|
||||
case FIELD_TYPE_NEWDECIMAL:
|
||||
#endif
|
||||
type = QVariant::Double;
|
||||
type = QMetaType::Double;
|
||||
break;
|
||||
case FIELD_TYPE_DATE :
|
||||
type = QVariant::Date;
|
||||
type = QMetaType::QDate;
|
||||
break;
|
||||
case FIELD_TYPE_TIME :
|
||||
// A time field can be within the range '-838:59:59' to '838:59:59' so
|
||||
// use QString instead of QTime since QTime is limited to 24 hour clock
|
||||
type = QVariant::String;
|
||||
type = QMetaType::QString;
|
||||
break;
|
||||
case FIELD_TYPE_DATETIME :
|
||||
case FIELD_TYPE_TIMESTAMP :
|
||||
type = QVariant::DateTime;
|
||||
type = QMetaType::QDateTime;
|
||||
break;
|
||||
case FIELD_TYPE_STRING :
|
||||
case FIELD_TYPE_VAR_STRING :
|
||||
@ -309,12 +309,12 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags)
|
||||
case FIELD_TYPE_TINY_BLOB :
|
||||
case FIELD_TYPE_MEDIUM_BLOB :
|
||||
case FIELD_TYPE_LONG_BLOB :
|
||||
type = (flags & BINARY_FLAG) ? QVariant::ByteArray : QVariant::String;
|
||||
type = (flags & BINARY_FLAG) ? QMetaType::QByteArray : QMetaType::QString;
|
||||
break;
|
||||
default:
|
||||
case FIELD_TYPE_ENUM :
|
||||
case FIELD_TYPE_SET :
|
||||
type = QVariant::String;
|
||||
type = QMetaType::QString;
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
@ -323,7 +323,7 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags)
|
||||
static QSqlField qToField(MYSQL_FIELD *field, QTextCodec *tc)
|
||||
{
|
||||
QSqlField f(toUnicode(tc, field->name),
|
||||
qDecodeMYSQLType(int(field->type), field->flags),
|
||||
QVariant::Type(qDecodeMYSQLType(int(field->type), field->flags)),
|
||||
toUnicode(tc, field->table));
|
||||
f.setRequired(IS_NOT_NULL(field->flags));
|
||||
f.setLength(field->length);
|
||||
@ -610,7 +610,7 @@ QVariant QMYSQLResult::data(int field)
|
||||
QString val;
|
||||
if (d->preparedQuery) {
|
||||
if (f.nullIndicator)
|
||||
return QVariant(f.type);
|
||||
return QVariant(QVariant::Type(f.type));
|
||||
|
||||
if (qIsInteger(f.type)) {
|
||||
QVariant variant(f.type, f.outField);
|
||||
@ -622,34 +622,34 @@ QVariant QMYSQLResult::data(int field)
|
||||
return variant;
|
||||
}
|
||||
|
||||
if (f.type != QVariant::ByteArray)
|
||||
if (f.type != QMetaType::QByteArray)
|
||||
val = toUnicode(d->drv_d_func()->tc, f.outField, f.bufLength);
|
||||
} else {
|
||||
if (d->row[field] == NULL) {
|
||||
// NULL value
|
||||
return QVariant(f.type);
|
||||
return QVariant(QVariant::Type(f.type));
|
||||
}
|
||||
|
||||
fieldLength = mysql_fetch_lengths(d->result)[field];
|
||||
|
||||
if (f.type != QVariant::ByteArray)
|
||||
if (f.type != QMetaType::QByteArray)
|
||||
val = toUnicode(d->drv_d_func()->tc, d->row[field], fieldLength);
|
||||
}
|
||||
|
||||
switch (static_cast<int>(f.type)) {
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return QVariant(val.toLongLong());
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return QVariant(val.toULongLong());
|
||||
case QMetaType::Char:
|
||||
case QMetaType::Short:
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
return QVariant(val.toInt());
|
||||
case QMetaType::UChar:
|
||||
case QMetaType::UShort:
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return QVariant(val.toUInt());
|
||||
case QVariant::Double: {
|
||||
case QMetaType::Double: {
|
||||
QVariant v;
|
||||
bool ok=false;
|
||||
double dbl = val.toDouble(&ok);
|
||||
@ -673,13 +673,13 @@ QVariant QMYSQLResult::data(int field)
|
||||
return v;
|
||||
return QVariant();
|
||||
}
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return qDateFromString(val);
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return qTimeFromString(val);
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return qDateTimeFromString(val);
|
||||
case QVariant::ByteArray: {
|
||||
case QMetaType::QByteArray: {
|
||||
|
||||
QByteArray ba;
|
||||
if (d->preparedQuery) {
|
||||
@ -689,7 +689,7 @@ QVariant QMYSQLResult::data(int field)
|
||||
}
|
||||
return QVariant(ba);
|
||||
}
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default:
|
||||
return QVariant(val);
|
||||
}
|
||||
@ -867,21 +867,21 @@ void QMYSQLResult::virtual_hook(int id, void *data)
|
||||
QSqlResult::virtual_hook(id, data);
|
||||
}
|
||||
|
||||
static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type)
|
||||
static MYSQL_TIME *toMySqlDate(QDate date, QTime time, int type)
|
||||
{
|
||||
Q_ASSERT(type == QVariant::Time || type == QVariant::Date
|
||||
|| type == QVariant::DateTime);
|
||||
Q_ASSERT(type == QMetaType::QTime || type == QMetaType::QDate
|
||||
|| type == QMetaType::QDateTime);
|
||||
|
||||
MYSQL_TIME *myTime = new MYSQL_TIME;
|
||||
memset(myTime, 0, sizeof(MYSQL_TIME));
|
||||
|
||||
if (type == QVariant::Time || type == QVariant::DateTime) {
|
||||
if (type == QMetaType::QTime || type == QMetaType::QDateTime) {
|
||||
myTime->hour = time.hour();
|
||||
myTime->minute = time.minute();
|
||||
myTime->second = time.second();
|
||||
myTime->second_part = time.msec() * 1000;
|
||||
}
|
||||
if (type == QVariant::Date || type == QVariant::DateTime) {
|
||||
if (type == QMetaType::QDate || type == QMetaType::QDateTime) {
|
||||
myTime->year = date.year();
|
||||
myTime->month = date.month();
|
||||
myTime->day = date.day();
|
||||
@ -971,30 +971,30 @@ bool QMYSQLResult::exec()
|
||||
currBind->length = 0;
|
||||
currBind->is_unsigned = 0;
|
||||
|
||||
switch (val.type()) {
|
||||
case QVariant::ByteArray:
|
||||
switch (val.userType()) {
|
||||
case QMetaType::QByteArray:
|
||||
currBind->buffer_type = MYSQL_TYPE_BLOB;
|
||||
currBind->buffer = const_cast<char *>(val.toByteArray().constData());
|
||||
currBind->buffer_length = val.toByteArray().size();
|
||||
break;
|
||||
|
||||
case QVariant::Time:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime: {
|
||||
MYSQL_TIME *myTime = toMySqlDate(val.toDate(), val.toTime(), val.type());
|
||||
case QMetaType::QTime:
|
||||
case QMetaType::QDate:
|
||||
case QMetaType::QDateTime: {
|
||||
MYSQL_TIME *myTime = toMySqlDate(val.toDate(), val.toTime(), val.userType());
|
||||
timeVector.append(myTime);
|
||||
|
||||
currBind->buffer = myTime;
|
||||
switch(val.type()) {
|
||||
case QVariant::Time:
|
||||
switch (val.userType()) {
|
||||
case QMetaType::QTime:
|
||||
currBind->buffer_type = MYSQL_TYPE_TIME;
|
||||
myTime->time_type = MYSQL_TIMESTAMP_TIME;
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
currBind->buffer_type = MYSQL_TYPE_DATE;
|
||||
myTime->time_type = MYSQL_TIMESTAMP_DATE;
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
currBind->buffer_type = MYSQL_TYPE_DATETIME;
|
||||
myTime->time_type = MYSQL_TIMESTAMP_DATETIME;
|
||||
break;
|
||||
@ -1004,32 +1004,32 @@ bool QMYSQLResult::exec()
|
||||
currBind->buffer_length = sizeof(MYSQL_TIME);
|
||||
currBind->length = 0;
|
||||
break; }
|
||||
case QVariant::UInt:
|
||||
case QVariant::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::Int:
|
||||
currBind->buffer_type = MYSQL_TYPE_LONG;
|
||||
currBind->buffer = data;
|
||||
currBind->buffer_length = sizeof(int);
|
||||
currBind->is_unsigned = (val.type() != QVariant::Int);
|
||||
currBind->is_unsigned = (val.userType() != QMetaType::Int);
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
currBind->buffer_type = MYSQL_TYPE_TINY;
|
||||
currBind->buffer = data;
|
||||
currBind->buffer_length = sizeof(bool);
|
||||
currBind->is_unsigned = false;
|
||||
break;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
currBind->buffer_type = MYSQL_TYPE_DOUBLE;
|
||||
currBind->buffer = data;
|
||||
currBind->buffer_length = sizeof(double);
|
||||
break;
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
currBind->buffer_type = MYSQL_TYPE_LONGLONG;
|
||||
currBind->buffer = data;
|
||||
currBind->buffer_length = sizeof(qint64);
|
||||
currBind->is_unsigned = (val.type() == QVariant::ULongLong);
|
||||
currBind->is_unsigned = (val.userType() == QMetaType::ULongLong);
|
||||
break;
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default: {
|
||||
QByteArray ba = fromUnicode(d->drv_d_func()->tc, val.toString());
|
||||
stringVector.append(ba);
|
||||
@ -1548,16 +1548,16 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons
|
||||
if (field.isNull()) {
|
||||
r = QStringLiteral("NULL");
|
||||
} else {
|
||||
switch(field.type()) {
|
||||
case QVariant::Double:
|
||||
switch (+field.type()) {
|
||||
case QMetaType::Double:
|
||||
r = QString::number(field.value().toDouble(), 'g', field.precision());
|
||||
break;
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
// Escape '\' characters
|
||||
r = QSqlDriver::formatValue(field, trimStrings);
|
||||
r.replace(QLatin1String("\\"), QLatin1String("\\\\"));
|
||||
break;
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
if (isOpen()) {
|
||||
const QByteArray ba = field.value().toByteArray();
|
||||
// buffer has to be at least length*2+1 bytes
|
||||
|
@ -1422,7 +1422,7 @@ bool QODBCResult::exec()
|
||||
SQLLEN *ind = &indicators[i];
|
||||
if (val.isNull())
|
||||
*ind = SQL_NULL_DATA;
|
||||
switch (val.type()) {
|
||||
switch (val.userType()) {
|
||||
case QVariant::Date: {
|
||||
QByteArray &ba = tmpStorage[i];
|
||||
ba.resize(sizeof(DATE_STRUCT));
|
||||
@ -1694,7 +1694,7 @@ bool QODBCResult::exec()
|
||||
return true;
|
||||
|
||||
for (i = 0; i < values.count(); ++i) {
|
||||
switch (values.at(i).type()) {
|
||||
switch (values.at(i).userType()) {
|
||||
case QVariant::Date: {
|
||||
DATE_STRUCT ds = *((DATE_STRUCT *)const_cast<char *>(tmpStorage.at(i).constData()));
|
||||
values[i] = QVariant(QDate(ds.year, ds.month, ds.day));
|
||||
@ -1735,7 +1735,7 @@ bool QODBCResult::exec()
|
||||
break; }
|
||||
}
|
||||
if (indicators[i] == SQL_NULL_DATA)
|
||||
values[i] = QVariant(values[i].type());
|
||||
values[i] = QVariant(QVariant::Type(values[i].userType()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ bool QSQLiteResult::exec()
|
||||
if (value.isNull()) {
|
||||
res = sqlite3_bind_null(d->stmt, i + 1);
|
||||
} else {
|
||||
switch (value.type()) {
|
||||
switch (value.userType()) {
|
||||
case QVariant::ByteArray: {
|
||||
const QByteArray *ba = static_cast<const QByteArray*>(value.constData());
|
||||
res = sqlite3_bind_blob(d->stmt, i + 1, ba->constData(),
|
||||
|
@ -612,30 +612,30 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
||||
if (field.isNull())
|
||||
r = nullTxt;
|
||||
else {
|
||||
switch (field.type()) {
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
if (field.value().type() == QVariant::Bool)
|
||||
switch (+field.type()) {
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
if (field.value().userType() == QMetaType::Bool)
|
||||
r = field.value().toBool() ? QLatin1String("1") : QLatin1String("0");
|
||||
else
|
||||
r = field.value().toString();
|
||||
break;
|
||||
#if QT_CONFIG(datestring)
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
if (field.value().toDate().isValid())
|
||||
r = QLatin1Char('\'') + field.value().toDate().toString(Qt::ISODate)
|
||||
+ QLatin1Char('\'');
|
||||
else
|
||||
r = nullTxt;
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
if (field.value().toTime().isValid())
|
||||
r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate)
|
||||
+ QLatin1Char('\'');
|
||||
else
|
||||
r = nullTxt;
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
if (field.value().toDateTime().isValid())
|
||||
r = QLatin1Char('\'') +
|
||||
field.value().toDateTime().toString(Qt::ISODate) + QLatin1Char('\'');
|
||||
@ -643,8 +643,8 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
||||
r = nullTxt;
|
||||
break;
|
||||
#endif
|
||||
case QVariant::String:
|
||||
case QVariant::Char:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::QChar:
|
||||
{
|
||||
QString result = field.value().toString();
|
||||
if (trimStrings) {
|
||||
@ -658,10 +658,10 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
||||
r = QLatin1Char('\'') + result + QLatin1Char('\'');
|
||||
break;
|
||||
}
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
r = QString::number(field.value().toBool());
|
||||
break;
|
||||
case QVariant::ByteArray : {
|
||||
case QMetaType::QByteArray : {
|
||||
if (hasFeature(BLOB)) {
|
||||
QByteArray ba = field.value().toByteArray();
|
||||
QString res;
|
||||
|
@ -48,7 +48,7 @@ class QSqlFieldPrivate
|
||||
public:
|
||||
QSqlFieldPrivate(const QString &name,
|
||||
QVariant::Type type, const QString &tableName) :
|
||||
ref(1), nm(name), table(tableName), def(QVariant()), type(type),
|
||||
ref(1), nm(name), table(tableName), def(QVariant()), type(QMetaType::Type(type)),
|
||||
req(QSqlField::Unknown), len(-1), prec(-1), tp(-1),
|
||||
ro(false), gen(true), autoval(false)
|
||||
{}
|
||||
@ -86,7 +86,7 @@ public:
|
||||
QString nm;
|
||||
QString table;
|
||||
QVariant def;
|
||||
QVariant::Type type;
|
||||
QMetaType::Type type;
|
||||
QSqlField::RequiredStatus req;
|
||||
int len;
|
||||
int prec;
|
||||
@ -399,7 +399,7 @@ QString QSqlField::name() const
|
||||
*/
|
||||
QVariant::Type QSqlField::type() const
|
||||
{
|
||||
return d->type;
|
||||
return QVariant::Type(d->type);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -411,12 +411,11 @@ QVariant::Type QSqlField::type() const
|
||||
void QSqlField::setType(QVariant::Type type)
|
||||
{
|
||||
detach();
|
||||
d->type = type;
|
||||
d->type = QMetaType::Type(type);
|
||||
if (!val.isValid())
|
||||
val = QVariant(type);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Returns \c true if the field's value is read-only; otherwise returns
|
||||
false.
|
||||
@ -526,7 +525,7 @@ bool QSqlField::isGenerated() const
|
||||
*/
|
||||
bool QSqlField::isValid() const
|
||||
{
|
||||
return d->type != QVariant::Invalid;
|
||||
return d->type != QMetaType::UnknownType;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
enum RequiredStatus { Unknown = -1, Optional = 0, Required = 1 };
|
||||
|
||||
explicit QSqlField(const QString& fieldName = QString(),
|
||||
QVariant::Type type = QVariant::Invalid);
|
||||
QVariant::Type type = {});
|
||||
QSqlField(const QString &fieldName, QVariant::Type type,
|
||||
const QString &tableName);
|
||||
|
||||
|
@ -645,7 +645,7 @@ bool QSqlResult::exec()
|
||||
for (i = d->holders.count() - 1; i >= 0; --i) {
|
||||
holder = d->holders.at(i).holderName;
|
||||
val = d->values.value(d->indexes.value(holder).value(0,-1));
|
||||
QSqlField f(QLatin1String(""), val.type());
|
||||
QSqlField f(QLatin1String(""), QVariant::Type(val.userType()));
|
||||
f.setValue(val);
|
||||
query = query.replace(d->holders.at(i).holderPos,
|
||||
holder.length(), driver()->formatValue(f));
|
||||
@ -659,7 +659,7 @@ bool QSqlResult::exec()
|
||||
if (i == -1)
|
||||
continue;
|
||||
QVariant var = d->values.value(idx);
|
||||
QSqlField f(QLatin1String(""), var.type());
|
||||
QSqlField f(QLatin1String(""), QVariant::Type(var.userType()));
|
||||
if (var.isNull())
|
||||
f.clear();
|
||||
else
|
||||
|
@ -218,7 +218,7 @@ template<> inline char *toString(const QVariant &v)
|
||||
vstring.append(type);
|
||||
if (!v.isNull()) {
|
||||
vstring.append(',');
|
||||
if (v.canConvert(QVariant::String)) {
|
||||
if (v.canConvert(QMetaType::QString)) {
|
||||
vstring.append(v.toString().toLocal8Bit());
|
||||
}
|
||||
else {
|
||||
|
@ -152,7 +152,7 @@ namespace QTest {
|
||||
inline bool matches(QtMsgType tp, const QString &message) const
|
||||
{
|
||||
return tp == type
|
||||
&& (pattern.type() == QVariant::String ?
|
||||
&& (pattern.userType() == QMetaType::QString ?
|
||||
stringsMatch(pattern.toString(), message) :
|
||||
#if QT_CONFIG(regularexpression)
|
||||
pattern.toRegularExpression().match(message).hasMatch());
|
||||
@ -292,7 +292,7 @@ void QTestLog::printUnhandledIgnoreMessages()
|
||||
QString message;
|
||||
QTest::IgnoreResultList *list = QTest::ignoreResultList;
|
||||
while (list) {
|
||||
if (list->pattern.type() == QVariant::String) {
|
||||
if (list->pattern.userType() == QMetaType::QString) {
|
||||
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
|
||||
} else {
|
||||
#if QT_CONFIG(regularexpression)
|
||||
|
@ -115,7 +115,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
|
||||
.arg(typeNameToXml(typeName));
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
|
||||
if (QDBusMetaType::signatureToType(typeName) == QMetaType::UnknownType)
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
|
||||
.arg(typeNameToXml(mm.normalizedType.constData()));
|
||||
} else {
|
||||
@ -159,7 +159,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
|
||||
isOutput ? QLatin1String("out") : QLatin1String("in"));
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
const char *typeName = QMetaType::typeName(types.at(j));
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n")
|
||||
.arg(isOutput ? QLatin1String("Out") : QLatin1String("In"))
|
||||
@ -225,7 +225,7 @@ static QString generateInterfaceXml(const ClassDef *mo)
|
||||
QLatin1String(signature),
|
||||
QLatin1String(accessvalues[access]));
|
||||
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
retval += QString::fromLatin1(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
|
||||
.arg(typeNameToXml(mp.type.constData()));
|
||||
} else {
|
||||
|
@ -211,7 +211,7 @@ static QString classNameForInterface(const QString &interface, ClassType classTy
|
||||
static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out", bool isSignal = false)
|
||||
{
|
||||
int type = QDBusMetaType::signatureToType(signature.toLatin1());
|
||||
if (type == QVariant::Invalid) {
|
||||
if (type == QMetaType::UnknownType) {
|
||||
QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
|
||||
if (paramId >= 0)
|
||||
annotationName += QString::fromLatin1(".%1%2").arg(QLatin1String(direction)).arg(paramId);
|
||||
|
@ -163,7 +163,7 @@ bool QUrlModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
*/
|
||||
bool QUrlModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (value.type() == QVariant::Url) {
|
||||
if (value.userType() == QMetaType::QUrl) {
|
||||
QUrl url = value.toUrl();
|
||||
QModelIndex dirIndex = fileSystemModel->index(url.toLocalFile());
|
||||
//On windows the popup display the "C:\", convert to nativeSeparators
|
||||
|
@ -10511,13 +10511,13 @@ QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const
|
||||
v = int(inputMethodHints());
|
||||
else if (dd->control)
|
||||
v = dd->control->inputMethodQuery(query, QVariant());
|
||||
if (v.type() == QVariant::RectF)
|
||||
if (v.userType() == QMetaType::QRectF)
|
||||
v = v.toRectF().translated(-dd->controlOffset());
|
||||
else if (v.type() == QVariant::PointF)
|
||||
else if (v.userType() == QMetaType::QPointF)
|
||||
v = v.toPointF() - dd->controlOffset();
|
||||
else if (v.type() == QVariant::Rect)
|
||||
else if (v.userType() == QMetaType::QRect)
|
||||
v = v.toRect().translated(-dd->controlOffset().toPoint());
|
||||
else if (v.type() == QVariant::Point)
|
||||
else if (v.userType() == QMetaType::QPoint)
|
||||
v = v.toPoint() - dd->controlOffset().toPoint();
|
||||
return v;
|
||||
}
|
||||
|
@ -1441,17 +1441,17 @@ QVariant QGraphicsProxyWidget::inputMethodQuery(Qt::InputMethodQuery query) cons
|
||||
focusWidget = d->widget;
|
||||
QVariant v = focusWidget->inputMethodQuery(query);
|
||||
QPointF focusWidgetPos = subWidgetRect(focusWidget).topLeft();
|
||||
switch (v.type()) {
|
||||
case QVariant::RectF:
|
||||
switch (v.userType()) {
|
||||
case QMetaType::QRectF:
|
||||
v = v.toRectF().translated(focusWidgetPos);
|
||||
break;
|
||||
case QVariant::PointF:
|
||||
case QMetaType::QPointF:
|
||||
v = v.toPointF() + focusWidgetPos;
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
v = v.toRect().translated(focusWidgetPos.toPoint());
|
||||
break;
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
v = v.toPoint() + focusWidgetPos.toPoint();
|
||||
break;
|
||||
default:
|
||||
|
@ -3190,13 +3190,13 @@ QVariant QGraphicsScene::inputMethodQuery(Qt::InputMethodQuery query) const
|
||||
return QVariant();
|
||||
const QTransform matrix = d->focusItem->sceneTransform();
|
||||
QVariant value = d->focusItem->inputMethodQuery(query);
|
||||
if (value.type() == QVariant::RectF)
|
||||
if (value.userType() == QMetaType::QRectF)
|
||||
value = matrix.mapRect(value.toRectF());
|
||||
else if (value.type() == QVariant::PointF)
|
||||
else if (value.userType() == QMetaType::QPointF)
|
||||
value = matrix.map(value.toPointF());
|
||||
else if (value.type() == QVariant::Rect)
|
||||
else if (value.userType() == QMetaType::QRect)
|
||||
value = matrix.mapRect(value.toRect());
|
||||
else if (value.type() == QVariant::Point)
|
||||
else if (value.userType() == QMetaType::QPoint)
|
||||
value = matrix.map(value.toPoint());
|
||||
return value;
|
||||
}
|
||||
|
@ -2589,13 +2589,13 @@ QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const
|
||||
return QVariant();
|
||||
|
||||
QVariant value = d->scene->inputMethodQuery(query);
|
||||
if (value.type() == QVariant::RectF)
|
||||
if (value.userType() == QMetaType::QRectF)
|
||||
value = d->mapRectFromScene(value.toRectF());
|
||||
else if (value.type() == QVariant::PointF)
|
||||
else if (value.userType() == QMetaType::QPointF)
|
||||
value = mapFromScene(value.toPointF());
|
||||
else if (value.type() == QVariant::Rect)
|
||||
else if (value.userType() == QMetaType::QRect)
|
||||
value = d->mapRectFromScene(value.toRect()).toRect();
|
||||
else if (value.type() == QVariant::Point)
|
||||
else if (value.userType() == QMetaType::QPoint)
|
||||
value = mapFromScene(value.toPoint());
|
||||
return value;
|
||||
}
|
||||
|
@ -585,27 +585,27 @@ QString QAbstractItemDelegatePrivate::textForRole(Qt::ItemDataRole role, const Q
|
||||
case QMetaType::Float:
|
||||
text = locale.toString(value.toFloat());
|
||||
break;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
text = locale.toString(value.toDouble(), 'g', precision);
|
||||
break;
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
text = locale.toString(value.toLongLong());
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
text = locale.toString(value.toULongLong());
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
text = locale.toString(value.toDate(), formatType);
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
text = locale.toString(value.toTime(), formatType);
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
text = locale.toString(value.toDateTime(), formatType);
|
||||
break;
|
||||
case QVariant::Type(QMetaType::QJsonValue): {
|
||||
case QMetaType::QJsonValue: {
|
||||
const QJsonValue val = value.toJsonValue();
|
||||
if (val.isBool()) {
|
||||
text = QVariant(val.toBool()).toString();
|
||||
|
@ -2339,7 +2339,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
|
||||
QVariant variant;
|
||||
if (d->model)
|
||||
variant = d->model->data(currentIndex(), Qt::DisplayRole);
|
||||
if (variant.type() == QVariant::String)
|
||||
if (variant.userType() == QMetaType::QString)
|
||||
QGuiApplication::clipboard()->setText(variant.toString());
|
||||
event->accept();
|
||||
}
|
||||
|
@ -3660,7 +3660,7 @@ void QHeaderViewPrivate::flipSortIndicator(int section)
|
||||
sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||
} else {
|
||||
const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole);
|
||||
if (value.canConvert(QVariant::Int))
|
||||
if (value.canConvert(QMetaType::Int))
|
||||
sortOrder = static_cast<Qt::SortOrder>(value.toInt());
|
||||
else
|
||||
sortOrder = Qt::AscendingOrder;
|
||||
|
@ -414,7 +414,7 @@ void QItemDelegate::paint(QPainter *painter,
|
||||
if (value.isValid()) {
|
||||
// ### we need the pixmap to call the virtual function
|
||||
pixmap = decoration(opt, value);
|
||||
if (value.type() == QVariant::Icon) {
|
||||
if (value.userType() == QMetaType::QIcon) {
|
||||
d->tmp.icon = qvariant_cast<QIcon>(value);
|
||||
d->tmp.mode = d->iconMode(option.state);
|
||||
d->tmp.state = d->iconState(option.state);
|
||||
@ -969,12 +969,12 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
|
||||
QPixmap QItemDelegate::decoration(const QStyleOptionViewItem &option, const QVariant &variant) const
|
||||
{
|
||||
Q_D(const QItemDelegate);
|
||||
switch (variant.type()) {
|
||||
case QVariant::Icon: {
|
||||
switch (variant.userType()) {
|
||||
case QMetaType::QIcon: {
|
||||
QIcon::Mode mode = d->iconMode(option.state);
|
||||
QIcon::State state = d->iconState(option.state);
|
||||
return qvariant_cast<QIcon>(variant).pixmap(option.decorationSize, mode, state); }
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
static QPixmap pixmap(option.decorationSize);
|
||||
pixmap.fill(qvariant_cast<QColor>(variant));
|
||||
return pixmap; }
|
||||
@ -1060,24 +1060,24 @@ QRect QItemDelegate::rect(const QStyleOptionViewItem &option,
|
||||
if (role == Qt::CheckStateRole)
|
||||
return doCheck(option, option.rect, value);
|
||||
if (value.isValid() && !value.isNull()) {
|
||||
switch (value.type()) {
|
||||
case QVariant::Invalid:
|
||||
switch (value.userType()) {
|
||||
case QMetaType::UnknownType:
|
||||
break;
|
||||
case QVariant::Pixmap: {
|
||||
case QMetaType::QPixmap: {
|
||||
const QPixmap &pixmap = qvariant_cast<QPixmap>(value);
|
||||
return QRect(QPoint(0, 0), pixmap.size() / pixmap.devicePixelRatio() ); }
|
||||
case QVariant::Image: {
|
||||
case QMetaType::QImage: {
|
||||
const QImage &image = qvariant_cast<QImage>(value);
|
||||
return QRect(QPoint(0, 0), image.size() / image.devicePixelRatio() ); }
|
||||
case QVariant::Icon: {
|
||||
case QMetaType::QIcon: {
|
||||
QIcon::Mode mode = d->iconMode(option.state);
|
||||
QIcon::State state = d->iconState(option.state);
|
||||
QIcon icon = qvariant_cast<QIcon>(value);
|
||||
QSize size = icon.actualSize(option.decorationSize, mode, state);
|
||||
return QRect(QPoint(0, 0), size); }
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
return QRect(QPoint(0, 0), option.decorationSize);
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default: {
|
||||
const QString text = d->valueToText(value, option);
|
||||
value = index.data(Qt::FontRole);
|
||||
|
@ -241,21 +241,21 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
{
|
||||
switch (userType) {
|
||||
#if QT_CONFIG(combobox)
|
||||
case QVariant::Bool: {
|
||||
case QMetaType::Bool: {
|
||||
QBooleanComboBox *cb = new QBooleanComboBox(parent);
|
||||
cb->setFrame(false);
|
||||
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
|
||||
return cb; }
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::UInt: {
|
||||
case QMetaType::UInt: {
|
||||
QSpinBox *sb = new QUIntSpinBox(parent);
|
||||
sb->setFrame(false);
|
||||
sb->setMinimum(0);
|
||||
sb->setMaximum(INT_MAX);
|
||||
sb->setSizePolicy(QSizePolicy::Ignored, sb->sizePolicy().verticalPolicy());
|
||||
return sb; }
|
||||
case QVariant::Int: {
|
||||
case QMetaType::Int: {
|
||||
QSpinBox *sb = new QSpinBox(parent);
|
||||
sb->setFrame(false);
|
||||
sb->setMinimum(INT_MIN);
|
||||
@ -264,25 +264,25 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
return sb; }
|
||||
#endif
|
||||
#if QT_CONFIG(datetimeedit)
|
||||
case QVariant::Date: {
|
||||
case QMetaType::QDate: {
|
||||
QDateTimeEdit *ed = new QDateEdit(parent);
|
||||
ed->setFrame(false);
|
||||
return ed; }
|
||||
case QVariant::Time: {
|
||||
case QMetaType::QTime: {
|
||||
QDateTimeEdit *ed = new QTimeEdit(parent);
|
||||
ed->setFrame(false);
|
||||
return ed; }
|
||||
case QVariant::DateTime: {
|
||||
case QMetaType::QDateTime: {
|
||||
QDateTimeEdit *ed = new QDateTimeEdit(parent);
|
||||
ed->setFrame(false);
|
||||
return ed; }
|
||||
#endif
|
||||
#if QT_CONFIG(label)
|
||||
case QVariant::Pixmap:
|
||||
case QMetaType::QPixmap:
|
||||
return new QLabel(parent);
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::Double: {
|
||||
case QMetaType::Double: {
|
||||
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
|
||||
sb->setFrame(false);
|
||||
sb->setMinimum(-DBL_MAX);
|
||||
@ -291,7 +291,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
|
||||
return sb; }
|
||||
#endif
|
||||
#if QT_CONFIG(lineedit)
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default: {
|
||||
// the default editor is a lineedit
|
||||
QExpandingLineEdit *le = new QExpandingLineEdit(parent);
|
||||
@ -311,24 +311,24 @@ QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
|
||||
{
|
||||
switch (userType) {
|
||||
#if QT_CONFIG(combobox)
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return "currentIndex";
|
||||
#endif
|
||||
#if QT_CONFIG(spinbox)
|
||||
case QVariant::UInt:
|
||||
case QVariant::Int:
|
||||
case QVariant::Double:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::Double:
|
||||
return "value";
|
||||
#endif
|
||||
#if QT_CONFIG(datetimeedit)
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return "date";
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return "time";
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return "dateTime";
|
||||
#endif
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default:
|
||||
// the default editor is a lineedit
|
||||
return "text";
|
||||
|
@ -302,8 +302,8 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
|
||||
value = index.data(Qt::DecorationRole);
|
||||
if (value.isValid() && !value.isNull()) {
|
||||
option->features |= QStyleOptionViewItem::HasDecoration;
|
||||
switch (value.type()) {
|
||||
case QVariant::Icon: {
|
||||
switch (value.userType()) {
|
||||
case QMetaType::QIcon: {
|
||||
option->icon = qvariant_cast<QIcon>(value);
|
||||
QIcon::Mode mode;
|
||||
if (!(option->state & QStyle::State_Enabled))
|
||||
@ -319,19 +319,19 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
|
||||
qMin(option->decorationSize.height(), actualSize.height()));
|
||||
break;
|
||||
}
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
QPixmap pixmap(option->decorationSize);
|
||||
pixmap.fill(qvariant_cast<QColor>(value));
|
||||
option->icon = QIcon(pixmap);
|
||||
break;
|
||||
}
|
||||
case QVariant::Image: {
|
||||
case QMetaType::QImage: {
|
||||
QImage image = qvariant_cast<QImage>(value);
|
||||
option->icon = QIcon(QPixmap::fromImage(image));
|
||||
option->decorationSize = image.size() / image.devicePixelRatio();
|
||||
break;
|
||||
}
|
||||
case QVariant::Pixmap: {
|
||||
case QMetaType::QPixmap: {
|
||||
QPixmap pixmap = qvariant_cast<QPixmap>(value);
|
||||
option->icon = QIcon(pixmap);
|
||||
option->decorationSize = pixmap.size() / pixmap.devicePixelRatio();
|
||||
|
@ -439,7 +439,7 @@ void QSizePolicy::setControlType(ControlType type) noexcept
|
||||
*/
|
||||
QSizePolicy::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::SizePolicy, this);
|
||||
return QVariant(QMetaType::QSizePolicy, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
|
@ -51,12 +51,12 @@ namespace {
|
||||
static void construct(QVariant::Private *x, const void *copy)
|
||||
{
|
||||
switch (x->type) {
|
||||
case QVariant::SizePolicy:
|
||||
case QMetaType::QSizePolicy:
|
||||
v_construct<QSizePolicy>(x, copy);
|
||||
break;
|
||||
default:
|
||||
qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type);
|
||||
x->type = QVariant::Invalid;
|
||||
x->type = QMetaType::UnknownType;
|
||||
return;
|
||||
}
|
||||
x->is_null = !copy;
|
||||
@ -65,7 +65,7 @@ static void construct(QVariant::Private *x, const void *copy)
|
||||
static void clear(QVariant::Private *d)
|
||||
{
|
||||
switch (d->type) {
|
||||
case QVariant::SizePolicy:
|
||||
case QMetaType::QSizePolicy:
|
||||
v_clear<QSizePolicy>(d);
|
||||
break;
|
||||
default:
|
||||
@ -73,7 +73,7 @@ static void clear(QVariant::Private *d)
|
||||
return;
|
||||
}
|
||||
|
||||
d->type = QVariant::Invalid;
|
||||
d->type = QMetaType::UnknownType;
|
||||
d->is_null = true;
|
||||
d->is_shared = false;
|
||||
}
|
||||
@ -88,7 +88,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
|
||||
{
|
||||
Q_ASSERT(a->type == b->type);
|
||||
switch(a->type) {
|
||||
case QVariant::SizePolicy:
|
||||
case QMetaType::QSizePolicy:
|
||||
return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b);
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
@ -111,7 +111,7 @@ static void streamDebug(QDebug dbg, const QVariant &v)
|
||||
{
|
||||
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
|
||||
switch (d->type) {
|
||||
case QVariant::SizePolicy:
|
||||
case QMetaType::QSizePolicy:
|
||||
dbg.nospace() << *v_cast<QSizePolicy>(d);
|
||||
break;
|
||||
default:
|
||||
|
@ -1547,11 +1547,10 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
QString valueStr;
|
||||
if(value.type() == QVariant::StringList || value.type() == QVariant::List)
|
||||
valueStr = value.toStringList().join(QLatin1Char(' '));
|
||||
else
|
||||
valueStr = value.toString();
|
||||
QString valueStr = (value.userType() == QMetaType::QStringList
|
||||
|| value.userType() == QMetaType::QVariantList)
|
||||
? value.toStringList().join(QLatin1Char(' '))
|
||||
: value.toString();
|
||||
cache[name] = valueStr;
|
||||
return valueStr;
|
||||
}
|
||||
@ -2611,16 +2610,16 @@ void QStyleSheetStyle::setProperties(QWidget *w)
|
||||
|
||||
QVariant v;
|
||||
const QVariant value = w->property(property.toLatin1());
|
||||
switch (value.type()) {
|
||||
case QVariant::Icon: v = decl.iconValue(); break;
|
||||
case QVariant::Image: v = QImage(decl.uriValue()); break;
|
||||
case QVariant::Pixmap: v = QPixmap(decl.uriValue()); break;
|
||||
case QVariant::Rect: v = decl.rectValue(); break;
|
||||
case QVariant::Size: v = decl.sizeValue(); break;
|
||||
case QVariant::Color: v = decl.colorValue(); break;
|
||||
case QVariant::Brush: v = decl.brushValue(); break;
|
||||
switch (value.userType()) {
|
||||
case QMetaType::QIcon: v = decl.iconValue(); break;
|
||||
case QMetaType::QImage: v = QImage(decl.uriValue()); break;
|
||||
case QMetaType::QPixmap: v = QPixmap(decl.uriValue()); break;
|
||||
case QMetaType::QRect: v = decl.rectValue(); break;
|
||||
case QMetaType::QSize: v = decl.sizeValue(); break;
|
||||
case QMetaType::QColor: v = decl.colorValue(); break;
|
||||
case QMetaType::QBrush: v = decl.brushValue(); break;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case QVariant::KeySequence: v = QKeySequence(decl.d->values.at(0).variant.toString()); break;
|
||||
case QMetaType::QKeySequence: v = QKeySequence(decl.d->values.at(0).variant.toString()); break;
|
||||
#endif
|
||||
default: v = decl.d->values.at(0).variant; break;
|
||||
}
|
||||
@ -4648,7 +4647,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
|
||||
}
|
||||
|
||||
if (baseStyle()->property("_q_styleSheetRealCloseButton").toBool())
|
||||
baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant(QVariant::Invalid));
|
||||
baseStyle()->setProperty("_q_styleSheetRealCloseButton", QVariant());
|
||||
}
|
||||
|
||||
QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap,
|
||||
@ -6128,7 +6127,7 @@ void QStyleSheetStyle::saveWidgetFont(QWidget* w, const QFont& font) const
|
||||
|
||||
void QStyleSheetStyle::clearWidgetFont(QWidget* w) const
|
||||
{
|
||||
w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid));
|
||||
w->setProperty("_q_styleSheetWidgetFont", QVariant());
|
||||
}
|
||||
|
||||
// Polish palette that should be used for a particular widget, with particular states
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user