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